excel


Is there a way to delete highlighted columns?


I'd like to run a macro/excel function that deletes columns that are highlighted. Is there an easy function do this?
We need to populate duplicate fields for internal procedure but need to remove the duplicates for external parties
Since you have an entire column highlighted in yellow, this will just check to see if the cell in row 1 is yellow. If so, it'll delete the column.
Sub deleteYellowColumns()
Dim lastCol As Long, i As Long
Dim ws as Worksheet
Set ws = Sheets("Sheet1") ' Change this as necessary
lastCol = ws.Cells(1, ws.Columns.Count).End(xlToLeft).Column
For i = lastCol To 1 Step -1
If ws.Cells(1, i).Interior.Color = 65535 Then ws.Cells(1, i).EntireColumn.Delete
Next i
End Sub

Related Links

Writing excel functions in vba
I need to be able to select columns in Excel by specifying column numbers in vba
How to update a specific row of a table in Excel using Microsoft Graph?
columns' values based on specific rows in pivot table excel
VBA Adding cells from one sheet to another by cell
Searchng a sheet for a value and returning row & column numbers
How to take a control of specific cell of XL?
Vlookup exact text on a cell text string
HTTP GET responds with empty body, downloads excel document in IE
VBA replace comma with line break in word?
Excel online sharing
Change cell value based off of selection from ListBox
How to remove hidden quotes
Sorting out data by insert and copy and paste special
Excel VB to create monthly table based on user input
Week number from Date format in excel(Monthwise_Week Number)

Categories

HOME
docker
google-analytics
dropbox-api
datastax
composer-php
uwp-xaml
servicestack
chromium
inform7
outlook-redemption
rhel
strongloop
wmi-query
alexa-voice-service
appcelerator-titanium
video.js
prefix
google-fusion-tables
markup
react-boilerplate
powerpoint-vba
mpeg
biblatex
hal
geckofx
week-number
wasapi
kinvey
puma
jung
ecore
street-address
gulp-4
appery.io
gsutil
sharethis
shieldui
jenkinsfile
laravel-excel
cics
winlims
enterprise-library-6
api-manager
canvas-lms
android-datepicker
webrole
ikvm
dnspython
c++1z
embedded-sql
jquery-events
same-origin-policy
siteminder
azure-webjobssdk
visual-c++-2013
twebbrowser
jodconverter
nokia
servant
mediafire
f#-interactive
iterm
stage3d
webots
sin
qubole
puphpet
apache-wink
review
vtune
avaloq-script
stop-words
mathgl
println
presentmodalviewcontrolle
dbase
rounded-corners
ereg
xadisk
file-association
mysql-5.0
clang-complete
memory-profiling
bionic
raw-ethernet
windows-explorer
dynamic-css
mkstorekit
maintaining-code

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile