Issue with exhibiting VBA Macro to create new sheets

Siddhu11011

Board Regular
Joined
Jun 22, 2022
Messages
56
Office Version
  1. 365
Platform
  1. Windows
Hi there.... I have macro in place to create sheets as per the date available in column E
Example:
I have 4 dates in column E such as
04/22 - 0428
Dates have been derived by Filter function

But I'm getting an error, please check below codes and advice
For each x "(range)" In Range ([E2], cells(rows.count, "E").End(xlup))
With rng
.Autofilter
..Autofilter Feild:=1, Criteria:=x.value
Sheets.add(After:=Sheets(Sheets.Count)).Name= x.value
End With
Next x

"Error is because of x.value" Any advice on this?
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Actually, it looks like you have a few errors.

First, you'll need to get rid of this part "(range)". So you'll need to replace...

VBA Code:
For each x "(range)" In Range ([E2], cells(rows.count, "E").End(xlup))

with

VBA Code:
For Each x In Range([E2], Cells(Rows.Count, "E").End(xlUp))

Then you'll need to remove the extra dot ( . ) at the beginning of your autofilter line, and you'll need to correct the spelling for the named arguments. So you'll need to replace...

VBA Code:
..Autofilter Feild:=1, Criteria:=x.value

with

VBA Code:
.AutoFilter field:=1, Criteria1:=x.Value

Hope this helps!
 
Upvote 0

Forum statistics

Threads
1,215,480
Messages
6,125,050
Members
449,206
Latest member
Healthydogs

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