Macro deleting a column

spice1624

New Member
Joined
Oct 11, 2023
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hi,
I am new to new macros and I can't figure out the code. It keeps deleting column "A" a second time after I have deleted the first time as there was nothing in it and I do not know why.

It also deletes some wording up the top that is exported from a web portal.

Columns("A:A").Select
Selection.Delete Shift:=xlToLeft
Rows("12:12").Select
Selection.AutoFilter
ActiveSheet.Range("$A$12:$K$6707").AutoFilter Field:=5, Criteria1:=Array( _
"Ballina Shire Council", "Bellingen Shire Council", "Byron Shire Council", _
"Central Coast Council", "Cessnock City Council", "Clarence Valley Council", _
"Coffs Harbour City Council", "Dungog Shire Council", "Kempsey Shire Council", _
"Kyogle Council", "Lake Macquarie City Council", "Lismore City Council", _
"Lord Howe Island Board", "Maitland City Council", "Mid-Coast Council", _
"Muswellbrook Shire Council", "Nambucca Valley Council", "Newcastle City Council" _
, "Port Macquarie-Hastings Council", "Port Stephens Council", _
"Richmond Valley Council", "Singleton Council", "Tenterfield Shire Council", _
"Tweed Shire Council", "Upper Hunter Shire Council", "="), Operator:= _
xlFilterValues
Rows("73:6703").Select
Selection.Delete Shift:=xlUp
Rows("1168:1169").Select
Selection.Delete Shift:=xlUp
ActiveSheet.Range("$A$12:$K$1169").AutoFilter Field:=5
Columns("B:B").Select
Selection.Delete Shift:=xlToLeft
Columns("F:F").Select
Selection.TextToColumns Destination:=Range("F1"), DataType:=xlDelimited, _
TextQualifier:=xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, _
Semicolon:=False, Comma:=False, Space:=False, Other:=False, FieldInfo _
:=Array(1, 4), TrailingMinusNumbers:=True
Selection.NumberFormat = "m/d/yyyy"
Selection.ColumnWidth = 15.14
Columns("H:H").Select
Selection.Style = "Accounting"
Range("E18").Select
ActiveWindow.ScrollColumn = 1
End Sub
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Welcome to the Board!

Can you post a small data sample for us to test it out on, and also show us what the final result of that data sample should look like after the code runs?
Just be sure to remove any sensitive data first.

MrExcel has a tool called “XL2BB” that lets you post samples of your data that will allow us to copy/paste it to our Excel spreadsheets, so we can work with the same copy of data that you are. Instructions on using this tool can be found here: XL2BB Add-in

Note that there is also a "Test Here” forum on this board. This is a place where you can test using this tool (or any other posting techniques that you want to test) before trying to use those tools in your actual posts.
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,954
Members
449,095
Latest member
nmaske

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