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

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
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,223,748
Messages
6,174,270
Members
452,553
Latest member
red83

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