excel-2010

Automatically updating Data Validation lists based on user input

此生再无相见时 提交于 2019-12-07 02:51:27
I have a very large data set (about 16k rows). I have 10 higher level blocks and within each block I have 4 categories (10 rows for each) which use Data Validation lists to show items available in each category. The lists should automatically update based on user input. What I need your help with is that I want to use the same data set for each block and preferably a least calculation/size intensive approach. I have put together a sample file that outlines the issue with examples. Sample File Thank you for your help in advance. Okay, I've found something, but it can be quite time consuming to

XlsxWriter: lock only specific cells

半世苍凉 提交于 2019-12-07 02:00:58
问题 I'm creating xlsx files with xlsxwriter and want to protect specific cells (for example all cells in a range B2:B20). The documentation says that you can use worksheet.protect() method - it's turn on protection for whole worksheet by default - and then you can use workbook.add_format({'locked': 0}) for unlocking specific cells. But I want vice versa - I want to lock only specific range of cells and leave the rest of the worksheet unlocked. How can I do this? 回答1: The way to do this is the

How to save as .txt in vba

為{幸葍}努か 提交于 2019-12-07 01:47:02
问题 I am looking to have my Macro save a new sheet that i created as a .txt file. this is the code i have so far. Sub Move() ' ' Move Macro ' ' Keyboard Shortcut: Ctrl+m ' Sheets("Sheet1").Select Range("A1").Select Range(Selection, Selection.End(xlToRight)).Select Range(Selection, Selection.End(xlDown)).Select Selection.Copy Workbooks.Add ActiveSheet.Paste ActiveWorkbook.SaveAs Filename:="e:" & _ "HDR" + Format(Now(), "YYYYMMDDhhmmss") & ".txt" End Sub That includes my macro. I am having trouble

VBA - Value of an option button in a frame (within an Excel sheet)

☆樱花仙子☆ 提交于 2019-12-06 18:46:29
I'm having problems with shapes, frames and option buttons... I'm a total newbie, I've never used them. I just put several option buttons on an Excel sheet (Using the FORM toolbox). I'm trying to check whether my optionbutton is filled or not. So far, I've done the following : Sub SX_EXTERNE() Dim Ws As Worksheet Dim ConBut As Shape Dim Answer As String Set Ws = ThisWorkbook.Sheets("Externe") For Each ConBut In Ws.Shapes If ConBut.Type = msoFormControl Then If ConBut.FormControlType = xlOptionButton Then If ConBut.ControlFormat.Value = xlOn Then Answer = ConBut.Name End If End If End If Next

Sum up similar values in VLOOKUP/INDEX-MATCH excel functions

北城以北 提交于 2019-12-06 16:38:49
I have an issue with a vlookup/index-match formula in excel 2010. I have a table that contains duplicate values in the name column. I have a table in another sheet that reference the name & amount from the first sheet. in case a duplicate name exist in the original table, it should sum the amount. For example, look at the pic below. ABC is a duplicate name, and it's amount should be zero. How can I use Vlookup/index-match formulas in order to display "0" in the result when I lookup the name ABC? In the destination sheet, the name only appears once, hence I don't want to add another ABC to the

Using Import wizard to import Excel data into table in SQL Server 2012 failing - text truncation

戏子无情 提交于 2019-12-06 15:55:32
I have an Excel file that I import weekly into a table. I am using Excel 2010 and SSMS 2012. The import failed this week and I have been unable to determine why. I was able to successfully import the data into a new table. The table definitions of the new table match the ones of my old table, so that does not seem to be the issue. Below is a screen shot of the error I receive. I have checked the PO header text field and there is nothing that exceeds the datatype of varchar(255) that I have it as. Also, I sorted the data just to see if a certain row was causing the issue and more data did

Merging Several Workbooks Into One Workbook with All the Workbooks as Sheets

痞子三分冷 提交于 2019-12-06 14:46:35
问题 I have 65 workbooks with one worksheet in each workbook. I need to combine all 65 workbooks into one workbook, with all the respective workbooks as 65 worksheets in the new workbook. I need to keep all the 65 workbook names as the worksheet names in the new SINGLE workbook. I have a code so far to do this that I found online for this, but this code requires that all the workbooks that will be merged, need to be OPEN. Is there any way to modify this code so that all the workbooks don't need to

Editing Hyperlinks Excel 2010 Macro

我的梦境 提交于 2019-12-06 14:26:50
Ok so I want to create a macro to replace a part of a hyperlink. I have tons of hyperlinks in the excel file. Is there a way to create a macro to do this. For example www.OldName.com/ www.Oldname.com/a/ www.Oldname.com/b/ to www.NewName.com/ www.NewName.com/a/ www.Newname.com/b/ This will replace your hyperlink, just change the addresses and strings: Range("E1").Hyperlinks.Add Range("E1"),Replace(Range("E1").Hyperlinks(1).Address, "google", "msn"), , , "newtext" 来源: https://stackoverflow.com/questions/6903884/editing-hyperlinks-excel-2010-macro

Excel 2010 VBA: How to store an array of worksheets as a variable?

╄→гoц情女王★ 提交于 2019-12-06 14:25:58
I am trying to have several arrays of my worksheets that I can call up in my code using. ThisWorkbook.Sheets(Array("Sheet1", "Sheet3")) ThisWorkbook.Sheets(Array("Sheet2", "Sheet5")) I am wondering if there is anyway to set up a variable similar to the following: Dim ArrayOne As String Dim ArrayTwo As String ArrayOne = ThisWorkbook.Sheets(Array("Sheet1", "Sheet3")) ArrayTwo = ThisWorkbook.Sheets(Array("Sheet2", "Sheet5")) ArrayOne 'Call this Array then save Filename:="C:\Data\testfile.xls", FileFormat:= _ xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _, CreateBackup:

error on sql script with 'openrowset'

谁说胖子不能爱 提交于 2019-12-06 13:41:28
I'm having a problem with my SQL script: SELECT SP.[MobileNumber], SP.[LastName], SP.[FirstName] FROM SampleTable1 SP INNER JOIN OPENROWSET ( 'Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=C:\devpc11\sample.xls;', 'SELECT MobileNumber, LastName, FirstName FROM [SampleData$]') T ON SP.[MobileNumber] = T.[MobileNumber] GO when i try to execute this, it generates this error: Msg 7357, Level 16, State 2, Line 1 Cannot process the object "SELECT MobileNumber, LastName, FirstName FROM [SampleData$]". The OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "(null)" indicates that either the