Results 1 to 19 of 19

VBA help with IF statement and moving to a new column

Threaded View

  1. #1
    Registered User
    Join Date
    10-18-2013
    Location
    Ohio
    MS-Off Ver
    Excel 07 & Mac 11
    Posts
    12

    VBA help with IF statement and moving to a new column

    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.

    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 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.

    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
    Last edited by good ol gal; 10-24-2013 at 05:07 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 4
    Last Post: 01-07-2015, 08:29 PM
  2. Replies: 5
    Last Post: 02-07-2012, 04:55 PM
  3. For Each cell in range and If statement. Prevent code moving on until If met
    By coasterman in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-29-2012, 11:28 AM
  4. URGENT IF STATEMENT REQUIRED:True if moving between financial years?
    By Ray Everingham in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-26-2006, 04:30 PM
  5. URGENT IF STATEMENT: True if moving between financial year's
    By Ray Everingham in forum Excel General
    Replies: 1
    Last Post: 05-26-2006, 04:25 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1