ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Do while (https://www.excelbanter.com/excel-programming/398699-do-while.html)

okrob

Do while
 
I've had a brain fart.
Can't remember how to save the initial cell to a variable
and do something while the first cell is NOT active.
Using Excel 2003...

Dim firstcell As Range ' this section is where my problem is...
ActiveCell = firstcell ' It won't save anything to firstcell

Cells.FindNext(After:=ActiveCell).Activate
ActiveCell.Offset(0, 0).EntireRow.Insert Shift:=xlDown
Do While ActiveCell Is Not firstcell
Cells.FindNext(After:=ActiveCell).Activate
Cells.FindNext(After:=ActiveCell).Activate
ActiveCell.Offset(0, 0).EntireRow.Insert Shift:=xlDown
Loop


Bob Phillips

Do while
 
Set firstCell = Activecell


--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"okrob" wrote in message
ups.com...
I've had a brain fart.
Can't remember how to save the initial cell to a variable
and do something while the first cell is NOT active.
Using Excel 2003...

Dim firstcell As Range ' this section is where my problem is...
ActiveCell = firstcell ' It won't save anything to firstcell

Cells.FindNext(After:=ActiveCell).Activate
ActiveCell.Offset(0, 0).EntireRow.Insert Shift:=xlDown
Do While ActiveCell Is Not firstcell
Cells.FindNext(After:=ActiveCell).Activate
Cells.FindNext(After:=ActiveCell).Activate
ActiveCell.Offset(0, 0).EntireRow.Insert Shift:=xlDown
Loop




okrob

Do while
 
On Oct 4, 11:20 am, "Bob Phillips" wrote:
Set firstCell = Activecell

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"okrob" wrote in message

ups.com...



I've had a brain fart.
Can't remember how to save the initial cell to a variable
and do something while the first cell is NOT active.
Using Excel 2003...


Dim firstcell As Range ' this section is where my problem is...
ActiveCell = firstcell ' It won't save anything to firstcell


Cells.FindNext(After:=ActiveCell).Activate
ActiveCell.Offset(0, 0).EntireRow.Insert Shift:=xlDown
Do While ActiveCell Is Not firstcell
Cells.FindNext(After:=ActiveCell).Activate
Cells.FindNext(After:=ActiveCell).Activate
ActiveCell.Offset(0, 0).EntireRow.Insert Shift:=xlDown
Loop- Hide quoted text -


- Show quoted text -


knew it was a simple brain fart.
Thanks Bob...



All times are GMT +1. The time now is 10:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com