I have written some code to loop through several values in a database and don’t understand something. Any assistance on this would be greatly appreciated.
Note the following code:
[indent]
With xlsheet
.Range(“A:A”).Select
With Selection
.ColumnWidth = “18”
.HorizontalAlignment = xlRight
End With
End With
[/indent] This code snipet is within a much larger loop. The first time through the loop, the code runs fine. The second time through (and I suppose all subsequent times, but I haven’t gotten that far yet), I get a “With Block variable not set” on the “.ColumnWidth…” line. I think that this means that my selection of “A:A” is invalid. Why would it work the first time through, but not the 2nd???