delete entire column based on color of top cell vba

Dslade1975

New Member
Joined
Oct 10, 2019
Messages
3
good morning.
long time viewer first time posting
I am having difficulty with a code to delete an entire column base on top cell color.
I supply a sample spreadhseet that has conditional formatting applied to highlight cell the equals A1.

looking for an VBA code that i can assign to a active x button if possible.

could anyone assist please, this is doing my head in :)
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Conditional formatting cannot be read by VBA. What you should do is provide information for the basis of creating a conditional format. Then applying that condition to determine which columns should be deleted.
 
Upvote 0
Conditional formatting cannot be read by VBA. What you should do is provide information for the basis of creating a conditional format. Then applying that condition to determine which columns should be deleted.


thank you for the advice Alan,

would it be possible to match a text/number string in A1 and search for the matching text/number in row B:B and delete the corresponding column?
thank you , i am very knew to VBA coding and am not sure what can work
 
Upvote 0
example
1 2 3 4 5
A h001
B Title No. H001 H002 h003 h004
C text 50 34 23 18
D text 18 72 18 20

I want to refer to A1 and delete the column with the same title on row B:B
 
Upvote 0
Hi @Dslade1975 and welcome to the forum!

If you want to know the color of a cell that has been colored by a conditional formatting then use

msgbox range("A1").DisplayFormat.Interior.Color
 
Upvote 0

Forum statistics

Threads
1,213,546
Messages
6,114,254
Members
448,556
Latest member
peterhess2002

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