ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   OR statement on macro (https://www.excelbanter.com/excel-programming/415275-statement-macro.html)

computers hate me

OR statement on macro
 
I have a macro that states
Do While .Cells(RowCount, "D").Value < ""
But i run into a problem because sometimes the database can have 100 values
on Column D but sometimes it fills up the entire spreadsheet up to the end
which is row 65536

When this happends the macro stops running because there is no cell on
Column D that is empty.
so i was wondering how i could make that work i thought an Or statement
would work so i used
RowCount=8
EndCell= 65536
Do While .Cells(RowCount, "D").Value < "" or Do Until .Cells(EndCell,
"D").Value<""

But that doesnt work


Bob Phillips[_3_]

OR statement on macro
 
Do While .Cells(RowCount, "D").Value < "" Or RowCount = .Rows.Count


--
__________________________________
HTH

Bob

"computers hate me" wrote in
message ...
I have a macro that states
Do While .Cells(RowCount, "D").Value < ""
But i run into a problem because sometimes the database can have 100
values
on Column D but sometimes it fills up the entire spreadsheet up to the end
which is row 65536

When this happends the macro stops running because there is no cell on
Column D that is empty.
so i was wondering how i could make that work i thought an Or statement
would work so i used
RowCount=8
EndCell= 65536
Do While .Cells(RowCount, "D").Value < "" or Do Until .Cells(EndCell,
"D").Value<""

But that doesnt work




computers hate me

OR statement on macro
 
that still gave me an error sign i then tried

rowcount=8
endcell=65536

Do While .Cells(RowCount, "D").Value < "" Or .Cells(Endcell, "D") = ""

it also returned an error message

i know its the fact that it goes to the last cell because when i delete the
content in cell 65536 my first macro (without the or) works just fine

"Bob Phillips" wrote:

Do While .Cells(RowCount, "D").Value < "" Or RowCount = .Rows.Count


--
__________________________________
HTH

Bob

"computers hate me" wrote in
message ...
I have a macro that states
Do While .Cells(RowCount, "D").Value < ""
But i run into a problem because sometimes the database can have 100
values
on Column D but sometimes it fills up the entire spreadsheet up to the end
which is row 65536

When this happends the macro stops running because there is no cell on
Column D that is empty.
so i was wondering how i could make that work i thought an Or statement
would work so i used
RowCount=8
EndCell= 65536
Do While .Cells(RowCount, "D").Value < "" or Do Until .Cells(EndCell,
"D").Value<""

But that doesnt work






All times are GMT +1. The time now is 02:53 AM.

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