Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I have a small problem with one line of code. Do While ActiveCell.Row < rw It is part of a loop that works but I need it to use the active cell from a certain sheet (Carriage). I have tried it as below but it doesnt work. Think this is just a basic code error but can't work it out. Do While Sheets("Carriage").ActiveCell.Row < rw Thanks. James -- fugfug ------------------------------------------------------------------------ fugfug's Profile: http://www.excelforum.com/member.php...o&userid=24950 View this thread: http://www.excelforum.com/showthread...hreadid=389017 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try something like
Dim Rng As Range Set Rng = Sheets("Carriage").ActiveCell While Rng.Row < rw ' do something Set Rng = Rng(2,1) Loop -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "fugfug" wrote in message ... I have a small problem with one line of code. Do While ActiveCell.Row < rw It is part of a loop that works but I need it to use the active cell from a certain sheet (Carriage). I have tried it as below but it doesnt work. Think this is just a basic code error but can't work it out. Do While Sheets("Carriage").ActiveCell.Row < rw Thanks. James -- fugfug ------------------------------------------------------------------------ fugfug's Profile: http://www.excelforum.com/member.php...o&userid=24950 View this thread: http://www.excelforum.com/showthread...hreadid=389017 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Good afternoon FugFug Your code is correct, however the ActiveCell is the currently selected cell in the currently selected sheet, so you cannot tell Excel to find the activecell in a diiferent sheet - that is why the error is returned. You will need to reference the address direct or load it into a variable and call it that way. HTH DominicB -- dominicb ------------------------------------------------------------------------ dominicb's Profile: http://www.excelforum.com/member.php...o&userid=18932 View this thread: http://www.excelforum.com/showthread...hreadid=389017 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Maybe...
Sheets("Carriage").select Do While ActiveCell.Row < rw .... fugfug wrote: I have a small problem with one line of code. Do While ActiveCell.Row < rw It is part of a loop that works but I need it to use the active cell from a certain sheet (Carriage). I have tried it as below but it doesnt work. Think this is just a basic code error but can't work it out. Do While Sheets("Carriage").ActiveCell.Row < rw Thanks. James -- fugfug ------------------------------------------------------------------------ fugfug's Profile: http://www.excelforum.com/member.php...o&userid=24950 View this thread: http://www.excelforum.com/showthread...hreadid=389017 -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Visual Basic code | Excel Discussion (Misc queries) | |||
I need a visual basic code....please | Excel Discussion (Misc queries) | |||
Visual basic Code | Excel Programming | |||
visual basic code | Excel Programming | |||
Visual Basic Code | Excel Programming |