I am using a variable (vItem) to find its column and select it.
Then I want to paste it to Sheet3 in a new column starting at D6.PHP Code:
Sheet4.Rows(1).Find(What:=vItem, LookAt:=xlWhole).EntireColumn.Copy
I have learned I cant select an entire column and paste to a cell in column D6 to its end.PHP Code:
Sheet3.Range("D6").PasteSpecial xlPasteValuesAndNumberFormats
I need to help to figure out how to select the range of cells in Sheet4 in the found Column, not the entire column.
What I have now.
All assistance is appreciated.PHP Code:
Private Sub CommandButton2_Click()
Dim rng1 As Range
Dim strSearch As String
strSearch = vItem
Set rng1 = Range("A:E").Find(strSearch, , xlValues, xlWhole)
If Not rng1 Is Nothing Then
MsgBox "Find has matched - " & strSearch 'for testing
'the Range approach
Sheet4.Rows(1).Find(What:=vItem, LookAt:=xlWhole).EntireColumn.Copy
Sheet3.Range("D6").PasteSpecial xlPasteValuesAndNumberFormats 'or xlPasteAll to include formulas
Else
MsgBox strSearch & " not found"
End If
End Sub
Bookmarks