Not the best with VBA

nathan663

Board Regular
Joined
Dec 3, 2008
Messages
153
I have recorded a macro, and edited it to as it is below:


Sheets.Add.Name = "Minor" 'Add Worksheets - with titles'
Sheets.Add.Name = "Fire Chargeable"
Sheets.Add.Name = "Fire Non Chargeable"
Sheets.Add.Name = "Chargeable"
Sheets.Add.Name = "Non Chargeable"
Sheets("Sheet 1").Select
Rows("1:1").Select
Selection.AutoFilter 'add filter'
Range("G2").Select
ActiveWindow.FreezePanes = True 'Freeze Pane'
Range("G5").Select
Selection.AutoFilter Field:=3, Criteria1:="MWK"
Rows("24:32").Select
Selection.Cut
Sheets("Minor").Select
Range("A2").Select
ActiveSheet.Paste
Sheets("Sheet 1").Select
Selection.AutoFilter Field:=3 'Close Filter'
Selection.AutoFilter Field:=27, Criteria1:="=CCTV*", Operator:=xlOr, _
Criteria2:="=ACC*" 'Filter for ACC and CCTV'
Rows("02:50").Select
Selection.Cut 'ONLY CUT ROWS THAT ARE VISIBLE'
Sheets("Chargeable").Select
Range("A2").Select
ActiveSheet.Paste
Range("B11").Select
Sheets("sheet 1").Select
Rows("1:1").Select
Selection.Copy
Sheets("Chargeable").Select
Rows("1:1").Select
ActiveSheet.Paste
Sheets("Fire Non Chargeable").Select
Rows("1:1").Select
ActiveSheet.Paste
Sheets("Fire Chargeable").Select
Rows("1:1").Select
ActiveSheet.Paste
Sheets("Minor").Select
Rows("1:1").Select
ActiveSheet.Paste
Sheets("Non Chargeable").Select
Rows("1:1").Select
ActiveSheet.Paste

where i have added a notation 'ONLY CUT ROWS THAT ARE VISIBLE'... How do i do this??? what code should i add.

Also can any one help me tidy this code up a little?
 

Excel Facts

Move date out one month or year
Use =EDATE(A2,1) for one month later. Use EDATE(A2,12) for one year later.

Forum statistics

Threads
1,216,481
Messages
6,130,920
Members
449,606
Latest member
jaybar0812

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