astrnzo
asked on
MS Excel VB copying a formula in to an undertermined amount of rows
Having recorded an extensive VB macro which sorts, adds/deletes, modifies, and recalculates a fairly large ASCII file, I run in to a problem when additional records are added to this file. Initially, part of the macro was set to copy a formula in cell D1 and paste it to an inserted column C1:C1129. Now that additional records have been added, the macro still only pastes to the extent of C1129. How can I have the macro copy the information in cell D1 and paste it to an (un)-predetermined amount of rows in column C to compensate for any additional records added?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
This also assumes you are using excel 97, if you are not you will need to change C65536 to C16384...
Frazer
Frazer
The code you want is....
Sub Copying()
Range("D1", Range("C65536").End(xlUp).
End Sub
This will select D1:D??? based on column C being filled....i.e. if column C is filled to row 13 then Range D1:D13 will be selected.
Hope this helps
Frazer