Format/Highlight a cell based on another cell color?

bazzinga

New Member
Joined
Dec 5, 2023
Messages
12
Office Version
  1. 2021
Platform
  1. Windows
Hello Everyone,

I created an example of my current spreadsheet. I would like to be able that the transposed(?) cells and copy the highlight (if any) based on the Data Set. Is it possible?
(in this case, A7 will automatically copy the highlight, and if not copy highlight)

Kind Regards,
B

1701888202404.png
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Not sure what your question is. The Excel Transpose function will not carry over the formatting. Copy/Paste using the "Transpose" option will copy the formatting too. You can automate the copy/transpose-paste by using a VBA macro that you either write or create by using the Excel Macro Recorder. If there is conditional formatting at play in the source cells, that may or may not add some additional complexity, but essentially it is doable.

VBA Code:
Sub Macro1()
    Dim SaveCell As Range

    Set SaveCell = ActiveCell
    With ActiveSheet
        .Range("C1:G2").Copy
        .Range("A4").PasteSpecial Paste:=xlPasteAll, Transpose:=True
        Application.CutCopyMode = False
        SaveCell.Select
    End With
End Sub
 
Upvote 0
Not sure what your question is. The Excel Transpose function will not carry over the formatting. Copy/Paste using the "Transpose" option will copy the formatting too. You can automate the copy/transpose-paste by using a VBA macro that you either write or create by using the Excel Macro Recorder. If there is conditional formatting at play in the source cells, that may or may not add some additional complexity, but essentially it is doable.

VBA Code:
Sub Macro1()
    Dim SaveCell As Range

    Set SaveCell = ActiveCell
    With ActiveSheet
        .Range("C1:G2").Copy
        .Range("A4").PasteSpecial Paste:=xlPasteAll, Transpose:=True
        Application.CutCopyMode = False
        SaveCell.Select
    End With
End Sub

Hi,

Sorry I got a bit lost. Hopefully I can explain it better:
If Cell F2 (or any cell in Line 2) is highlighted, Can I get some indication of the highlight on column A when transposing the data from Line 2. So in this case, A7 would highlight.

I never used VBA, but if I can get some pointer, maybe I can google the rest to understand how to use VBA better.
 
Upvote 0
If Cell F2 (or any cell in Line 2) is highlighted, Can I get some indication of the highlight on column A when transposing the data from Line 2. So in this case, A7 would highlight.
Yes, and that is what the VBA code sample I posted does.

1701897146199.png



Hi,
I never used VBA, but if I can get some pointer, maybe I can google the rest to understand how to use VBA better.

There are some pretty good youtube video tutorials designed for complete beginners that would be a good place to start. Search for "learn VBA" and take your pick. Once you learn how to use the debugger you can single step through the code sample I posted and watch what it does.
 
Upvote 0
Solution
Yes, and that is what the VBA code sample I posted does.

View attachment 103092




There are some pretty good youtube video tutorials designed for complete beginners that would be a good place to start. Search for "learn VBA" and take your pick. Once you learn how to use the debugger you can single step through the code sample I posted and watch what it does.
Thank you! Will give it a try
 
Upvote 0

Forum statistics

Threads
1,215,110
Messages
6,123,149
Members
449,098
Latest member
Doanvanhieu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top