hi
how can i change the range in the row below into a variable
[VBA] g = Sheets("sheet3").Range("B65536").End(xlUp).row[/VBA]
thanks
hi
how can i change the range in the row below into a variable
[VBA] g = Sheets("sheet3").Range("B65536").End(xlUp).row[/VBA]
thanks
[vba]
With Worksheets("Sheet3")
g = .Cells(.Rows.Count, "B").End(xlUp).Row
Set rng = .Range("B1"),Resize(g)
End With
[/vba]
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
It writs me "syntax error"Originally Posted by xld
what should i do?
Sorry, should be
[vba]
With Worksheets("Sheet3")
g = .Cells(.Rows.Count, "B").End(xlUp).Row
Set rng = .Range("B1").Resize(g)
End With
[/vba]
____________________________________________
Nihil simul inventum est et perfectum
Abusus non tollit usum
Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
James Thurber
how can i write this macro that instead of "B" will be 2 and instead ofOriginally Posted by xld
"b1" will be (2 & 1)
Are you changing yet again the substance of a question because you didn't ask the correct question or supply the correct data at the initial post?
Remember To Do the Following....
Use [Code].... [/Code] tags when posting code to the thread.
Mark your thread as Solved if satisfied by using the Thread Tools options.
If posting the same issue to another forum please show the link
Check out the Cells notation eg
[VBA]
Set rng = Cells(2,1)
[/VBA]
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'