+ Reply to Thread
Results 1 to 3 of 3

Keeping cell format the same throught range using vb macro

  1. #1
    Registered User
    Join Date
    10-04-2014
    Location
    Sydney, Australia
    MS-Off Ver
    2003
    Posts
    18

    Keeping cell format the same throught range using vb macro

    Hi TMS,

    Just a quick question. Thank you for the below macro, but when I use the macro it doesn't paste the cell formula (IE Color). Assuming format painter maybe required? Have tried to record and add it in VB but couldn't get it to work.

    Sorry - Just to Clarrify, Going from VLOOKUP "A5" to Amend Logistics Report "AN2". The VLOOKUP A5 has the correct format already, I want to copy/paste the cell format as well.

    Any help would be appreciated. Thanks...


    Sub Test_V2()
    Dim lLR As Long
    Sheets("VLOOKUP").Range("A5").Copy _
    Sheets("Amend Logistics Report").Range("AN2")
    Application.CutCopyMode = False
    With Sheets("Amend Logistics Report")
    lLR = .Range("X2").End(xlDown).Row
    .Range("AN2:AN" & lLR).Formula = "=VLOOKUP(X2,VLOOKUP!D:E,2,FALSE)"
    End With
    End Sub
    Last edited by SCACCHIA; 10-31-2014 at 08:40 PM. Reason: Issue Solved

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,463

    Re: Keeping cell format the same throught range using vb macro

    Please use Code Tags when you post code excerpts.

    Please Login or Register  to view this content.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Registered User
    Join Date
    10-04-2014
    Location
    Sydney, Australia
    MS-Off Ver
    2003
    Posts
    18

    Smile Re: Keeping cell format the same throught range using vb macro

    Thanks TMS, that worked... Apologies, I will use Code Tags in future...

    Regards,
    Steve

+ 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] Loop macro displaying only certain cells and keeping their format
    By Antoine27182818 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-15-2014, 12:21 PM
  2. Creating Pivot throught Macro
    By vkaushal in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-23-2013, 06:27 PM
  3. Keeping Format When Selecting Range To Email
    By alulla in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-27-2013, 03:31 PM
  4. Keeping the same color coding throught different graphs
    By ANS in forum Excel Charting & Pivots
    Replies: 0
    Last Post: 10-24-2012, 06:24 AM
  5. keeping cell format with formula
    By JAB in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-17-2006, 08:40 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