Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
I am trying to copy a group of cells from one spread sheet and move it
to another sheet after the 2nd sheet is opened. It will not let me set the variable WkBk2. Let me know if you see nay issues with this code. Thanks, Jay Private Sub OptionButton1_Click() Dim C1, C2 As Range Dim WkBk2 As Workbook Dim Sht2 As Worksheet Set C1 = Selection Dim NextRow As Long Workbooks.Open Filename:="G:\Masters\External Sales Masters \Pumpernickel Press\Current CGC run info sheets - Regular PMP Runs.xls" Set WkBk2 = Wokbook("Current CGC run info sheets - Regular PMP Runs.xls") Set Sht2 = WkBk2.Sheet1 Set C2 = WkBk2.Sht2.Range("A4:AC10") NextRow = Sht2.Range("B65536").End(xlUp).Row + 2 C2.Copy Range("A" & NextRow).PasteSpecial (xlPasteAll) C1.Copy Range("B" & NextRow).PasteSpecial (xlPasteValues) Range("J" & NextRow, "R" & NextRow + 8).Copy Range("J" & NextRow).PasteSpecial (xlPasteValues) Range("B" & NextRow).NumberFormat = ";;;" Range("B" & NextRow + 1) = "Run " & Range("B" & NextRow + 1).Value Unload Me End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
variable substitution in a formula linking to external workbook | Excel Discussion (Misc queries) | |||
External reference with variable workbook name? | New Users to Excel | |||
How do I link to a workbook whose name is variable? | Excel Discussion (Misc queries) | |||
Use of variable to identify range of sheets in a workbook | Excel Discussion (Misc queries) | |||
Getting data from another workbook based on variable | Excel Discussion (Misc queries) |