I new to VBA and would like help trying to figure out how to write this code.
I have a file that has multiple columns that may have the same data..but not in the same column and I want to have all the same data in the same column.
For example: Column D has last names and Column E has last names. I want to put all of the last names into a column.
I tried doing an If Then statement, but it keeps coming back as an error.
I was thinking that I would just do a cut/paste to the very end of the spreadsheet, then after all the of the code is done, I will enter a code in to delete all the empty columns that will now be at the beginning of the worksheet after they've all been moved.
Columns("F:F").Select
If LRegion = "Building IRN" Then
Columns("E:E").Cut Destination:=Columns("Y:Y")
ElseIf LRegion = "Employee ID" Then
Columns("E:E").Cut Destination:=Columns("Z:Z")
I am attaching a copy of a sample worksheet for anyone to look at.
Thanks so much for your help! I am having a ball learning this!! VBA If Then.xlsm
Bookmarks