Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
simple for each problem
any ideas why this is incorrect? Thanks for your help!
Range("b65536").End(xlUp).Select rnglst = ActiveCell.Row For Each rg In Range("a10:" & Range("a" & rnglst)) rg.Select If rg 0 Then rg.Copy rg.Offset(0, 1).Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False End If Next |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
simple for each problem
You ave to add .Address to this line
For Each rg In Range("a10:" & Range("a" & rnglst)) like this For Each rg In Range("a10:" & Range("a" & rnglst).Address) otherwise Range("a" & rnglst) returns the value in that cell and not the address of the cell (value is the default property of a range, not address). -- HTH... Jim Thomlinson "John" wrote: any ideas why this is incorrect? Thanks for your help! Range("b65536").End(xlUp).Select rnglst = ActiveCell.Row For Each rg In Range("a10:" & Range("a" & rnglst)) rg.Select If rg 0 Then rg.Copy rg.Offset(0, 1).Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False End If Next |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
simple for each problem
this works, thanks Jim
"Jim Thomlinson" wrote: You ave to add .Address to this line For Each rg In Range("a10:" & Range("a" & rnglst)) like this For Each rg In Range("a10:" & Range("a" & rnglst).Address) otherwise Range("a" & rnglst) returns the value in that cell and not the address of the cell (value is the default property of a range, not address). -- HTH... Jim Thomlinson "John" wrote: any ideas why this is incorrect? Thanks for your help! Range("b65536").End(xlUp).Select rnglst = ActiveCell.Row For Each rg In Range("a10:" & Range("a" & rnglst)) rg.Select If rg 0 Then rg.Copy rg.Offset(0, 1).Select Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False End If Next |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Simple IF problem | Excel Worksheet Functions | |||
Simple problem, simple formula, no FUNCTION ! | Excel Worksheet Functions | |||
Simple problem | New Users to Excel | |||
Help simple problem | Excel Programming | |||
Simple problem | Excel Discussion (Misc queries) |