+ Reply to Thread
Results 1 to 6 of 6

Set format of adjacent cells based on value

  1. #1
    Registered User
    Join Date
    04-04-2014
    Location
    Nottingham
    MS-Off Ver
    Excel 2003
    Posts
    3

    Set format of adjacent cells based on value

    Hi All,

    Experienced excel user but just starting to use VBA and new to your great forum.
    I've already found a lot of very helpful posts, but I've reached a sticking point.

    I have list based data validation to set a cell (A1) to USD, EUR, GBP or CAD.
    I need the next 2 cells (B1:C1) in the row to be set to the correct number format depending on the value selected.

    If I'm going about it the right way I already have:

    Please Login or Register  to view this content.
    Not sure where to go next, hopefully someone can point me in the right direction.

    Thanks in advance, Alex.

  2. #2
    Forum Guru Kaper's Avatar
    Join Date
    12-14-2013
    Location
    Warsaw, Poland
    MS-Off Ver
    most often: Office 365 in Windows environment
    Posts
    8,863

    Re: Set format of adjacent cells based on value

    not tested, but it seems, that presented code is a part of Change event handler and after checking if target is your A1 cell you shall have
    Please Login or Register  to view this content.
    Best Regards,

    Kaper

  3. #3
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: Set format of adjacent cells based on value

    Here is the encapsulation of your partial code:

    Please Login or Register  to view this content.
    Gary's Student

  4. #4
    Registered User
    Join Date
    04-04-2014
    Location
    Nottingham
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Set format of adjacent cells based on value

    Thanks Kaper & Jakobshavn, that's got it, works perfectly! Starting to understand now

    I have a list of items, what would it take to make this code apply to each row?
    Or maybe it should be relative to the edited cell?

    Kind regards,

    Alex.

  5. #5
    Registered User
    Join Date
    04-04-2014
    Location
    Nottingham
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Set format of adjacent cells based on value

    Jakobshavn, I just realised your code already does this.
    Can't say thank you enough!

    Many thanks,

    Alex.

  6. #6
    Forum Expert Jakobshavn's Avatar
    Join Date
    08-17-2012
    Location
    Lakehurst, NJ, USA
    MS-Off Ver
    Excel 2007
    Posts
    1,970

    Re: Set format of adjacent cells based on value

    Thanks for the feedback...............have a Great Day!

+ 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. How to Conditional Format based on adjacent cells
    By pcarmas in forum Excel General
    Replies: 3
    Last Post: 10-21-2013, 05:33 PM
  2. [SOLVED] Conditioning format based on adjacent cell
    By lokwungkwung in forum Excel General
    Replies: 6
    Last Post: 08-20-2013, 08:36 AM
  3. Replies: 1
    Last Post: 03-02-2013, 05:06 AM
  4. Replies: 1
    Last Post: 04-26-2010, 04:53 AM
  5. [SOLVED] Format cell based on adjacent cells values
    By the majestic ferny in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-16-2005, 02:35 PM

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