Replicate data using fill down.

  • Thread starter Thread starter Centurion
  • Start date Start date
C

Centurion

Hello,

What VBA coding would allow me to replicate data down
coloum C when I dont know the total number of rows.

A B C
D
1 Casting 234 = concatenate(A1,B1)
| | |
| | |
V V V



Having done the formula replication, I would then
copy the selected cells and paste the Value into Coloum
'D'

Thanks in anticipation.
 
hello again...so you want column c's formula to be extended for the
length of column A (cuz VBA can figure out the length of a column
without you telling it an actual number)?
 
Hi Centurion

You can try this with code (it will fill till the last cell in A)

Sub test()
Dim LastRow As Long
With Worksheets("Sheet1")
LastRow = .Cells(Rows.Count, "A").End(xlUp).Row
.Range("A1:C1").AutoFill Destination:=.Range("A1:C" & LastRow) _
, Type:=xlFillDefault
End With
End Sub
 
Oops, Sorry

I send the wrong version

This will copy the formula in C1 down till the row from the last value in A
And copy the value of the formula in D

Sub test()
Dim LastRow As Long
With Worksheets("Sheet1")
LastRow = .Cells(Rows.Count, "A").End(xlUp).Row
.Range("C1").AutoFill Destination:=.Range("C1:C" & LastRow) _
, Type:=xlFillDefault
.Range("D1:D" & LastRow).Value = .Range("C1:C" & LastRow).Value
End With
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl



Ron de Bruin said:
Hi Centurion

You can try this with code (it will fill till the last cell in A)

Sub test()
Dim LastRow As Long
With Worksheets("Sheet1")
LastRow = .Cells(Rows.Count, "A").End(xlUp).Row
.Range("A1:C1").AutoFill Destination:=.Range("A1:C" & LastRow) _
, Type:=xlFillDefault
End With
End Sub
 
Thanks Ron,

Will try it out later.

--
Centurion


Ron de Bruin said:
Oops, Sorry

I send the wrong version

This will copy the formula in C1 down till the row from the last value in A
And copy the value of the formula in D

Sub test()
Dim LastRow As Long
With Worksheets("Sheet1")
LastRow = .Cells(Rows.Count, "A").End(xlUp).Row
.Range("C1").AutoFill Destination:=.Range("C1:C" & LastRow) _
, Type:=xlFillDefault
.Range("D1:D" & LastRow).Value = .Range("C1:C" & LastRow).Value
End With
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top