I have macros to dynamically create columns (via an "Add" button) in tables across multiple sheets in my workbook, in some cases on sheets containing multiple tables. I would like to also have a "Remove" button that finds all columns containing text "toolname" in all tables in the workbook and deletes them.
I've tried a few different loops but am not sure how to go about actually finding and deleting columns based on said text, whether it should be a structured reference or a range, etc. Pretty big vba noob here so any help in the right direction would definitely be appreciated!
Something like this to find what you are looking for ?
Dim rng As Range
Set rng = Cells.Find(What:="toolname", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False)
If Not rng Is Nothing Then
'if no matches is found
End If
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.