ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   how do i get my macro to only work on data thats there? (https://www.excelbanter.com/excel-discussion-misc-queries/88257-how-do-i-get-my-macro-only-work-data-thats-there.html)

welshmag

how do i get my macro to only work on data thats there?
 
The macro that i've written is to concatenate cells with data in, the number
of rows can vary depending on the sort of data I'm working with. The macro
works, it concatenates the cells that i've asked it to, however, it
concatenates the empty cells below the data also, resulting in problems when
i try and sort the data after i have run the macro - it brings empty cells up
to the top. Would be very appreciative if anyone knows what value I can
write in the script so that the macro works on data that is there, no matter
how many rows down it is.

papou

how do i get my macro to only work on data thats there?
 
Hello
You may use some code like this:
For i = 1 to Worksheets("Sheet1").range("a65536").end(xlup).row
'your stuff here
Next i

HTH
Cordially
Pascal

"welshmag" a écrit dans le message de
news: ...
The macro that i've written is to concatenate cells with data in, the
number
of rows can vary depending on the sort of data I'm working with. The
macro
works, it concatenates the cells that i've asked it to, however, it
concatenates the empty cells below the data also, resulting in problems
when
i try and sort the data after i have run the macro - it brings empty cells
up
to the top. Would be very appreciative if anyone knows what value I can
write in the script so that the macro works on data that is there, no
matter
how many rows down it is.





All times are GMT +1. The time now is 02:35 PM.

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