hii, i want to copy the values from col(b2)

August 29, 2011 at 21:38:42
Specs: Windows XP
i have values in colB, i want to copy the value 9 from colB to colC
i have used this code, but m not getting the exact output which i need.
here is my code
Dim i As Integer
Dim Cell As Range
For Each Cell In Range("B")
If Cell.Value = "9" Then
Range("B").Copy Destination:=Range("C").Value
End If

See More: hii, i want to copy the values from col(b2)

Report •

August 30, 2011 at 03:23:19
put this code behind a button and make some tweaks to best fit your requirements.
i made some assumptions about how you want the number 9 to move across, i assumed you wanted it to move one step to the right.

Private Sub CommandButton1_Click()

Dim LRange, URange
Dim BCell As Range

Set URange = Range("B1")
Set LRange = Range("B10")

For Each BCell In Range(URange, LRange)

If BCell.Value = 9 Then
BCell.Offset(0, 1).Value = BCell.Value
End If

Next BCell

End Sub

Report •
Related Solutions

Ask Question