excel-vba

Copy multiple cell colours from one worksheet to another

∥☆過路亽.° 提交于 2020-01-16 18:54:06
问题 I am a novice when it comes to building VBA code. I want to automatically copy cell colours from one worksheet to another. I have provided some images below to help explain what I am hoping to achieve: Worksheet 1 - Mar 18: Worksheet 7 - Site 1: Looking at Worksheet 1 - Mar 18, I want to copy the cell colours from row 3 (B3 to X3) to Worksheet 7 - site 1 Column B (B3 to B23). I also have additional worksheets, Apr 18 to Dec 18 and Site 2 to Site 6 where I would like to perform similar actions

Returning a value for an actual cell address

左心房为你撑大大i 提交于 2020-01-16 18:48:34
问题 I have two sheets: sheet1 and sheet2. In sheet2 I have a column "C" called addresses and in that column I have actual cell addresses such as $J$740, $H$756, etc, all referring to cell locations in Sheet1. In sheet1 in column "B" are names. I would like to be able to return the names from sheet1 column "B" to column "G" of sheet2 that belong to the cell address from column "C" in sheet2. Is there an Excel formula that will do this? 回答1: Yes. This is very the purpose of the INDIRECT function.

Run-time Error '1004' in excel vba

自古美人都是妖i 提交于 2020-01-16 18:42:36
问题 For some reason I keep getting a range global runtime error when I try to run the following script. Any help would be greatly appreciated. Sub crossUpdate() Dim rng As Range Set rng = Sheet1.Cells.Range("A2").End(xlDown) Range(rng).Select End Sub 回答1: Try changing your code into: Sub crossUpdate() Dim rng As Range ActiveWorkbook.Sheets("Sheet1").Select Set rng = ActiveWorkbook.Sheets("Sheet1").Range("A2").End(xlDown) rng.Select End Sub 回答2: Whenever you select a range, you must have already

excel userform webbrowser control on multipage control

北城余情 提交于 2020-01-16 18:40:31
问题 Has anyone tried using a webbrowser control on a multipage control, when you switch between the pages and then switch back again the webbrowser control diss-appears? 回答1: web browser control not working on the multipage control seems a common problem, and so far I did not see a solution. Here is the solution I devised. It merely re-creates the web browser control each time the page is selected. Dim wbr As SHDocVw.WebBrowser Private Sub MultiPage1_Change() If MultiPage1.SelectedItem.Name =

IF A1 has content - run macroA Else do nothing …?

为君一笑 提交于 2020-01-16 18:35:28
问题 I have a button signed to a Macro, However if cell A1 has no content I get the debug error (runs via that) I was wondering, as title says.. Can I run a IF command with a Macro? So, If Sheet1!A1 = ANY content (differs from time to time) THEN run macroA IF Sheet1!A1 = no content THEN do nothing (button just does nothing) Possible? 回答1: Please try: Sub Macro1() If WorksheetFunction.CountA(Range("A1")) = 0 Then MsgBox "A1 is empty" Else Application.Run "Macro2()" 'edit macro name to suit End If

IF A1 has content - run macroA Else do nothing …?

不问归期 提交于 2020-01-16 18:35:13
问题 I have a button signed to a Macro, However if cell A1 has no content I get the debug error (runs via that) I was wondering, as title says.. Can I run a IF command with a Macro? So, If Sheet1!A1 = ANY content (differs from time to time) THEN run macroA IF Sheet1!A1 = no content THEN do nothing (button just does nothing) Possible? 回答1: Please try: Sub Macro1() If WorksheetFunction.CountA(Range("A1")) = 0 Then MsgBox "A1 is empty" Else Application.Run "Macro2()" 'edit macro name to suit End If

Can it be possible to make “SourceData:= _” variable

谁说胖子不能爱 提交于 2020-01-16 18:24:12
问题 I have the code below came from a registered macro for creating a pivot table, my wich is to this code available for next row that will be present in the sheet "DONNEES", columns will not increment only, It's look like I can set it like "DONNEES!R1C1:R65500C16" but can it be more proper, with a variable that I can include, `ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _ "DONNEES!R1C1:R1553C16", Version:=xlPivotTableVersion10).CreatePivotTable _ TableDestination:=

Timestamping and copying a line to another sheet, if certain condition met

可紊 提交于 2020-01-16 18:19:10
问题 I need my audit list to (1) add a time stamp in the end of current line and then (2) copy the line to the other sheet, when there is a "N" or "n" marked in the specified column. The idea is to get a summary of copied non-conformities. My trouble is that in the case of the code I use, it only deals with the first column correctly. It does nothing with others. I use the code (below). Sub Worksheet_Change(ByVal Target As Range) On Error GoTo ErrHandler Application.EnableEvents = False If Target

Unable to import data in excel from another website using VB code

送分小仙女□ 提交于 2020-01-16 18:12:33
问题 I am try to import some data in excel from a website using VB code. During course of testing first got error 438 in login section which was rectified by respected Mr. Siddharth Rout (Thanks again) through my earlier question Runtime error 438 while importing data in excel from secured website using VBA. Now i am facing error 438 in following section and unable to import data / excel sheet remain blank. 'get the table based on the table’s id Set ieDoc = ieApp.Document Set ieTable = ieDoc.all

List sheet names in a sheet, hyperlink them, and update list whenever sheets are added/deleted

北城余情 提交于 2020-01-16 18:06:08
问题 I have found several codes that lists all the sheet names in a sheet and hyperlink them. I want to list all the sheets in the sheet "ListSheet" and make them hyperlinks. Two issues with the following code: 1) It should delete the previous list and insert the new one, in case I add or delete sheets (sub add_list() or sub delete_list()), but when I delete sheets the list keeps the old sheet names (so the list is probably not deleted before the new is created). 2) The list always created in the