Dear all,
I need to do a code until the last column with data in one line, but
in this code belown, if there is a column with no data, the code
doesn't work very well, because it doesn't count this column.
count = 1
col = Application.CountA(Worksheets("resume").Rows(4))
Do Until count = col
A B C D E F G H I ...
1 2 3 4 5 6 7
With this variant, the code will run until the number 7 because col is
equal 7, but I need that the code run until 9.
How can I solve this problem? I have different number of columns!
Thanks in advance!!!
André.
Don Guillett - 14 Sep 2007 21:14 GMT
do until count=cells(4,columns.count).end(xltoleft).column

Signature
Don Guillett
Microsoft MVP Excel
SalesAid Software
dguillett1@austin.rr.com
Dear all,
I need to do a code until the last column with data in one line, but
in this code belown, if there is a column with no data, the code
doesn't work very well, because it doesn't count this column.
count = 1
col = Application.CountA(Worksheets("resume").Rows(4))
Do Until count = col
A B C D E F G H I ...
1 2 3 4 5 6 7
With this variant, the code will run until the number 7 because col is
equal 7, but I need that the code run until 9.
How can I solve this problem? I have different number of columns!
Thanks in advance!!!
André.
Dave Peterson - 14 Sep 2007 21:21 GMT
Maybe...
dim LastCol as long
dim myCount as long 'I wouldn't use a variable named Count
with worksheets("resume")
LastCol = .cells(4,.columns.count).end(xltoleft).column
'rest of code here
> Dear all,
>
[quoted text clipped - 18 lines]
>
> André.

Signature
Dave Peterson