Macro to copy formatting

BokiB

New Member
Joined
Jul 19, 2010
Messages
40
Hey,

I am looking for help on a very specific issue.

Let's say you have cell A1 and A2. And on the same worksheet I have a list of 20 countries (D1:D20) and right next to it (E1:E:20) the cells are formatted according to currency (so D1 has USA and E1 is formatted with currency $)

I am looking for a macro which can combine LOOKUP and copying the formatting. So if cell A1 states USA, it will search through the list and the formatting in cell A2 will be formatted with $.

Thanks for your help!
 

Some videos you may like

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

Richard Schollar

MrExcel MVP
Joined
Apr 19, 2005
Messages
23,707
It wouldn't be in numeric format but you could do this:
Excel Workbook
ABCDE
1USA$100.00100GBP#,##0.00
2GBP43.4043.4USA$#,##0.00
3Euro#,##0.00
Sheet1
Excel 2002
Cell Formulas
RangeFormula
B1=TEXT(C1,VLOOKUP(A1,$D$1:$E$3,2,0))
B2=TEXT(C2,VLOOKUP(A2,$D$1:$E$3,2,0))
 

Subscribe on YouTube

Watch MrExcel Video

Forum statistics

Threads
1,106,765
Messages
5,513,292
Members
408,943
Latest member
ola abufroukh

This Week's Hot Topics

  • Sort code advice please
    Hi, I have the code below which im trying to edit but getting a little stuck. This was the original code which worked fine,columns A-F would sort...
  • SUMPRODUCT with nested If statement
    Hi everyone, Hope you're all well. I'm hoping someone will be able to point me in the right direction with a problem I'm having with a SUMPRODUCT...
  • VBA - simple sort is killing me!
    Hello all! This should be so easy, but not for me, apparently! I have a table of data that can be of varying lengths and widths. My current macro...
  • Compare Two Lists
    I have two Lists and I need to be able to Identify differences between them. List 100 comes from a workbook - the other is downloaded form the...
  • Formula that deducts points for each code I input.
    I am trying to create a formula that will have each student in my class start at 100 points and then for each code that I enter (PP for Poor...
  • Conditional formatting formula required for day of week and a value
    Hi, I have a really simple spreadsheet where column A is the date, column B is the activity total shown as a number and column C states the day of...
Top