Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50194

pick next blank cell in range to add some values.

$
0
0
hi forum
trying to build a macro to find some values on my sheet and paste them in to a specific range,
but im stuck at the moment because my very little knowledge in vba.

the macro works for the first selection i make . but when i try to search for new value it over write the cell.

i need some code so if the cell in range is not blank move to next the range where i need the values is (a45:a58)







Code:

Dim R As Range, FindAddress As String

rowH = 45

With Range("C5:c58,E20:E58")
Set R = .Find(Range("H54").Value, SearchOrder:=xlByColumns)
If R Is Nothing Then
MsgBox ("name not found")
Exit Sub


End If

 
      FindAddress = R.Address
      Range(FindAddress).Select
      ActiveCell.Copy Destination:=Range("A" & rowH & "")
      ActiveCell.ClearContents
     
      Range("h54").ClearContents
     
   
 
End With

Set R = Nothing


End Sub


Viewing all articles
Browse latest Browse all 50194