Thread
:
Dynamic copying of rows
View Single Post
#
2
Posted to microsoft.public.excel.programming
Dave Peterson
external usenet poster
Posts: 35,218
Dynamic copying of rows
If there's no data in column C, then the count (probably countA()) wouldn't
work. But if there's data in column C, then you're gonna overwrite it?
If you can pick out a column that can be used to determine the last row number,
you can do something like:
dim LastRow as long
with activesheet
lastrow = .cells(.rows.count,"A").end(xlup).row 'I used column A
.range("c6").autofill destination:=.range("c6:c" & lastrow)
end with
wrote:
This might be very easy question, but very hard for me. I try to do VBA
code where I copy one formula to rows. When I record a macro I get
this code:
Sub uusikopsaus()
Range("C6").Select
Selection.AutoFill Destination:=Range("C6:C20"),
Type:=xlFillDefault
Range("C6:C20").Select
End Sub
This code is okay, but how I should change it such way that range
function get parameters from COUNT function. This is pseudocode, but
idea is this kind of:
Selection.AutoFill Destination:=Range("C6:C[COUNT(C:C)]")
Thanks in advance
--
Dave Peterson
Reply With Quote
Dave Peterson
View Public Profile
Find all posts by Dave Peterson