Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Range references in VB
I am trying to loop through rows and paste data on each row. I keep getting
an error code on this (even though it should be VERY simple)! j=1 Sheets("Array 1").Range("A75:ES75").Copy Sheets(Cbo_Product & "_BidformPage1").Select Range("A" & j).Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False blah blah blah. I get the error on the Range("A" & j).select line. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Range references in VB
dim sh as Worksheet On Error resume Next set sh = Sheets(Cbo_Product & "_BidformPage1") On error goto 0 if not sh is nothing then j=1 Sheets("Array 1").Range("A75:ES75").Copy sh.Range("A" & j).PasteSpecial _ Paste:=xlPasteValues, _ Operation:=xlNone, _ SkipBlanks:=False, _ Transpose:=False else Msgbox "Sheet not found" End if -- Regards, Tom Ogilvy "MathCzyk" wrote: I am trying to loop through rows and paste data on each row. I keep getting an error code on this (even though it should be VERY simple)! j=1 Sheets("Array 1").Range("A75:ES75").Copy Sheets(Cbo_Product & "_BidformPage1").Select Range("A" & j).Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False blah blah blah. I get the error on the Range("A" & j).select line. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Range references in VB
Assuming that the value of j does not overflow then the statement is
correct. But you cannot select a cell if the sheet is protected. You could try.... Range("A" & j)..PasteSpecial Paste:=xlPasteValues to avoid the selects. -- Cheers Nigel "MathCzyk" wrote in message ... I am trying to loop through rows and paste data on each row. I keep getting an error code on this (even though it should be VERY simple)! j=1 Sheets("Array 1").Range("A75:ES75").Copy Sheets(Cbo_Product & "_BidformPage1").Select Range("A" & j).Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False blah blah blah. I get the error on the Range("A" & j).select line. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Making all references in a range absolute | Excel Discussion (Misc queries) | |||
How to rename references from range names to cell references | Excel Discussion (Misc queries) | |||
Arrays and range references in VBA | Excel Programming | |||
Column and row references of range | Excel Programming | |||
Bracketed Range References | Excel Programming |