+ Reply to Thread
Results 1 to 3 of 3

Insert Column with vLookup formula

Hybrid View

MileHigh_PhD Insert Column with vLookup... 07-24-2013, 12:13 PM
MileHigh_PhD Re: Insert Column with... 07-24-2013, 12:18 PM
arlu1201 Re: Insert Column with... 07-25-2013, 03:03 AM
  1. #1
    Registered User
    Join Date
    01-20-2013
    Location
    Denver, Colorado
    MS-Off Ver
    2011 (mac)
    Posts
    48

    Insert Column with vLookup formula

    Hi Forum,

    Once again I find myself turning to this great forum to try to find a solution to a VBA question I have. I'm wanting to insert a column onto a spreadsheet that contains a vLookup formula. Right now I have the following code, which copies select columns from one worksheet ("SiteMaster") and copies the columns to a second worksheet ("HSmSchedule"):

    Sub CopyColumns()
         
        Application.Calculation = xlCalculationManual
        Sheets("SiteMaster").Columns("A:A").Copy Sheets("HSmSchedule").Columns("A:A")
        'Sheets("SiteMaster").Columns("B:B").Copy Sheets("HSmSchedule").Columns("B:B") <---- This is where I want to add the vLookup
        Sheets("SiteMaster").Columns("DF:DF").Copy Sheets("HSmSchedule").Columns("C:C")
        Sheets("SiteMaster").Columns("DG:DG").Copy Sheets("HSmSchedule").Columns("D:D")
        Sheets("SiteMaster").Columns("DH:DH").Copy Sheets("HSmSchedule").Columns("E:E")
        Sheets("SiteMaster").Columns("DI:DI").Copy Sheets("HSmSchedule").Columns("F:F")
        Sheets("SiteMaster").Columns("DJ:DJ").Copy Sheets("HSmSchedule").Columns("G:G")
        Sheets("SiteMaster").Columns("DK:DK").Copy Sheets("HSmSchedule").Columns("H:H")
        Sheets("SiteMaster").Columns("DL:DL").Copy Sheets("HSmSchedule").Columns("I:I")
        Sheets("SiteMaster").Columns("DM:DM").Copy Sheets("HSmSchedule").Columns("J:J")
        Sheets("SiteMaster").Columns("DN:DN").Copy Sheets("HSmSchedule").Columns("K:K")
        Sheets("SiteMaster").Columns("DO:DO").Copy Sheets("HSmSchedule").Columns("L:L")
        Sheets("SiteMaster").Columns("DP:DP").Copy Sheets("HSmSchedule").Columns("M:M")
        Sheets("SiteMaster").Columns("DQ:DQ").Copy Sheets("HSmSchedule").Columns("N:N")
        Sheets("SiteMaster").Columns("DR:DR").Copy Sheets("HSmSchedule").Columns("O:O")
        Sheets("SiteMaster").Columns("DS:DS").Copy Sheets("HSmSchedule").Columns("P:P")
        Sheets("SiteMaster").Columns("DT:DT").Copy Sheets("HSmSchedule").Columns("Q:Q")
        Sheets("SiteMaster").Columns("DU:DU").Copy Sheets("HSmSchedule").Columns("R:R")
        Sheets("SiteMaster").Columns("DV:DV").Copy Sheets("HSmSchedule").Columns("S:S")
        Sheets("SiteMaster").Columns("DW:DW").Copy Sheets("HSmSchedule").Columns("T:T")
        Sheets("SiteMaster").Columns("DX:DX").Copy Sheets("HSmSchedule").Columns("U:U")
        
     Application.Calculation = xlCalculationAutomatic
    Application.CutCopyMode = False
    
    End Sub
    I want to add the following vLookup
    =VLOOKUP(A2,Provider,2,TRUE)
    into column B on the second worksheet ("HSmSchedule"), but I only want the formula to be copied to rows that contain values copied into column A on the second worksheet. Anybody have any ideas on how I can make this happen? Thanks!

  2. #2
    Registered User
    Join Date
    01-20-2013
    Location
    Denver, Colorado
    MS-Off Ver
    2011 (mac)
    Posts
    48

    Re: Insert Column with vLookup formula

    Never mind...I simply added the vLookup to the master worksheet ("SiteMaster") then copied the values like I did with the other columns. Sorry for the wasted thread!

  3. #3
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: Insert Column with vLookup formula

    No thread is wasted. It will surely help someone, somewhere.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Macro Insert Vlookup Formula
    By smmeader in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-18-2012, 12:18 PM
  2. [SOLVED] Formula to Insert the No 1 in column b when a number is detected in Column A
    By leinster93 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-29-2012, 11:21 AM
  3. Replies: 4
    Last Post: 01-22-2011, 07:33 AM
  4. insert text based on vlookup condition in two column
    By isabella in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-10-2010, 09:19 PM
  5. Insert value from vlookup and not formula with VBA
    By Les Stout in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-22-2005, 05:05 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