Jun 08 2022 01:01 PM - edited Jun 08 2022 01:08 PM
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 | Data5 |
3 | 666 | Data6 |
So far all good. Then, I want a button/macro to do the following:
D | E | |
10 | Unique ID | Data |
11 | 333 | Data3 |
12 | 444 | Data4 |
13 | 555 | Data5 |
14 | 666 | Data6 |
"output_table"
Any help to correct code? Thanks a lot in advance!
Robert,
Norway
Jun 08 2022 01:35 PM
SolutionSub 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
Jun 13 2022 11:35 PM
Jun 08 2022 01:35 PM
SolutionSub 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