excel-vba

Excel 2010: how to use autocomplete in validation list

扶醉桌前 提交于 2020-01-09 08:54:41
问题 I'm using a large validation list on which a couple of vlookup() functions depend. This list is getting larger and larger. Is there a way to type the first letters of the list item I'm looking for, instead of manually scrolling down the list searching for the item? I've done some Googling but this suggests that this is indeed possible in earlier versions of Excel, but not in Excel 2010. Hope you guys can help. 回答1: Here is a very good way to handle this (found on ozgrid): Let's say your list

Creating and Naming Worksheet in Excel VBA [closed]

纵然是瞬间 提交于 2020-01-09 04:17:29
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . I have some very simple code that adds a new Worksheet, after the current worksheets, to an Excel document, and then changes its name to one entered in a text box on a userform. Works fine on a new workbook,

Copy a partial row of data from one sheet to a new sheet within the same workbook based on cell content

纵然是瞬间 提交于 2020-01-07 17:51:38
问题 I have scoured the web for a solution to this challenge that I am having, but have not found a suitable solution. I have decent with formulas, but have no experience in VBA or other programming within Excel. I am hoping that one of the many Excel gurus can help me solve this challenge. Sample Sheet https://dl.dropboxusercontent.com/u/95272767/Sample%20Sheet.xlsx The rows of data always begin in row 4 and can extend down to row 1000. I have a sheet of data (Linked Above) that was produced by

Generate automatically name of the sheets

核能气质少年 提交于 2020-01-07 09:43:13
问题 Is it possible to generate automatically the name of the sheet? For example I want to name the sheets in the following way: "chart1", "chart2", "chart3".. Thanks! 回答1: The Worksheet.Name property can be used to change the name of the worksheet in VBA. This can be either done when creating new sheets, or set afterwards with the Worksheets(x).Name , where x is either the name of the worksheet you want to change, or an index. For more information you can check the MSDN page about Worksheets. 来源:

If not like vba [closed]

懵懂的女人 提交于 2020-01-07 09:23:37
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . i wanted to apply a condition (Deleting rows) if a particular cell format is NOT hourly format I tried the below code but it doesn't work Sub delete_row() Dim i As Integer Dim LR As Long LR = Range("A" & Rows.Count).End(xlUp).Row For i = 1 To LR If Not Cells(i, 1).Value Like "##:##-##:##" Then Cells(n, 1)

How to change VBA array decimal separator?

血红的双手。 提交于 2020-01-07 09:21:51
问题 I would like to change VBA array decimal separator to dot. I see it as comma. I tried: Application.DecimalSeparator="." But when I get the value as MyString = matrix(2, 1) , the decimal separator in VBA arrays maliciously persists as comma. I am not able to get rid of the pest. Is there a way to detect which system separator for VBA arrays is used? 回答1: VBA uses quite a few bits drawn from various parts of the platform to work out which decimal and thousands separator to use. Application

For Each Worksheet in Workbook [duplicate]

╄→гoц情女王★ 提交于 2020-01-07 09:15:14
问题 This question already has answers here : Excel VBA, getting range from an inactive sheet (3 answers) Closed 4 years ago . Any thoughts on why the below code would not be looping through the worksheets? I'm trying to set a column in each sheet based on what the sheet name is. It's getting stuck on the active worksheet, and ignoring the If ws.Name <> "Default" . This is built as a module: Sub LangID_update() Dim wb As Workbook: Set wb = ThisWorkbook Dim ws As Worksheet Dim LastCol As Integer

For Each Worksheet in Workbook [duplicate]

这一生的挚爱 提交于 2020-01-07 09:15:13
问题 This question already has answers here : Excel VBA, getting range from an inactive sheet (3 answers) Closed 4 years ago . Any thoughts on why the below code would not be looping through the worksheets? I'm trying to set a column in each sheet based on what the sheet name is. It's getting stuck on the active worksheet, and ignoring the If ws.Name <> "Default" . This is built as a module: Sub LangID_update() Dim wb As Workbook: Set wb = ThisWorkbook Dim ws As Worksheet Dim LastCol As Integer

Two input cells equal to each other

為{幸葍}努か 提交于 2020-01-07 09:07:58
问题 Is it possible to create two input cells that are equal to each other without VBA code eg. A1 = A5 and A5 = A1. So when I change the value of A1 it affects A5 and change in A5 makes A1 change too. 回答1: No, it is not. It will require VBA. A cell can have a formula or it can have a user supplied value but not both. The only way is VBA. You can have a third cell, say B1. Then have the user change B1 and equate A1 and A5 to B1: =B1 Then the user only needs to change one cell and the others will

vba: create pivot table

旧城冷巷雨未停 提交于 2020-01-07 08:38:08
问题 I have to create a pivot table using vba but i got the following error: "Run-time error '438' Object doesn't support this property or method" about this code: ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _ "Sheet1!R1C1:R1048576C8", Version:=6).CreatePivotTable TableDestination:= _ pivotTableWs!R1C1, tableName:=tableName, DefaultVersion:=6 here the complete source Dim tableName As String Dim pivotTableWs As Worksheet tableName = "pivotTableName" Set pivotTableWs =