Sub CopyPasteColumns() Dim t As Range PartsDeptUserForm.Show 'Find PartsDeptLBValue in Row 4 With Sheets("ImportData").Rows(4) Set t = .Find(PartsDeptLBValue, lookat:=xlPart) 'If found, copy the column to PAD2, Column A 'If not found, present a message If Not t Is Nothing Then Columns(t.Column).EntireColumn.Copy _ Destination:=Worksheets("PAD2").Range("A2") Else: MsgBox "Title Not Found" End If End With End Sub
Sub CopyPasteColumns() Dim desc As String PartsDeptUserForm.Show Sheets("ImportData").Select desc = WorksheetFunction.Match( PartsDeptLBValue, Rows("1:1"), 0) Sheets("ImportData").Columns(desc).Copy Destination:=Sheets("PAD2").Range("A2") End Sub
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
An Experts Exchange subscription includes unlimited access to online courses.Get Started
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE