PDA

View Full Version : Solved: Repeat B2 values based on rows on column A



justdream
11-03-2011, 11:25 AM
Dears,

Kindly share with me: VBA code to repeate B2 value; repetition number equal to Column_A rows

Dave
11-03-2011, 09:35 PM
It's kind of difficult to understand your needs. Here's abit of code that may get you strarted. Dave

Dim LastRow As Integer, Cnt As Integer
With Sheets("Sheet1")
LastRow = .Range("A" & .Rows.Count).End(xlUp).Row
End With
For Cnt = 3 To LastRow
Sheets("Sheet1").Cells(Cnt, "B") = Sheets("Sheet1").Range("B" & 2)
Next Cnt

abdulla
11-05-2011, 12:52 AM
you can also try with this code Dim LR As Integer, i As Integer

LR = Range("A" & Rows.Count).End(xlUp).Row

For i = 3 To LR
Cells(i, "B").Value = Range("B2").Value
Next i