Forum Discussion
roboed
Jun 08, 2022Copper Contributor
Macro to copy/paste to a specific cell
Hi. Need some guiding here... Assume the following data in normal cells (not a table). Data is generated via various drop-downs and formulas etc. A B 1 Unique ID Data 2 555 D...
- Jun 08, 2022
Sub CopyData() Dim rng As Range Set rng = ActiveSheet.ListObjects("Table1").ListColumns("Unique ID").DataBodyRange.Find(What:=Range("A2").Value, LookAt:=xlWhole) If rng Is Nothing Then Beep Else Range("A2:B3").Copy Destination:=rng Application.CutCopyMode = False End If End Sub
HansVogelaar
Jun 08, 2022MVP
Sub CopyData()
Dim rng As Range
Set rng = ActiveSheet.ListObjects("Table1").ListColumns("Unique ID").DataBodyRange.Find(What:=Range("A2").Value, LookAt:=xlWhole)
If rng Is Nothing Then
Beep
Else
Range("A2:B3").Copy Destination:=rng
Application.CutCopyMode = False
End If
End Subroboed
Jun 14, 2022Copper Contributor
Thanks Hans! With some tweeking it worked - but you got me in the right direction. Much appreciated.
Robert
Robert