ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   macro populated sheets is very good yet something i may miss here. (https://www.excelbanter.com/excel-programming/393973-macro-populated-sheets-very-good-yet-something-i-may-miss-here.html)

driller

macro populated sheets is very good yet something i may miss here.
 
Hi to someone,
Please help !

the template sheet i have has an autofilter on a range...

on one of the filter along column A...
it is set-up this way
custom
show rows where
"is greater than" [i put zero] 0.

i need to incorporate a *code* to auto-refresh or repeat the set-up again on
the same location on each populated sheets...
show rows where
"is greater than" [i put zero] 0.


---here's the brief code below:
Sub USetUp()

Application.Calculation = xlManual

Dim ws1 As Worksheet, ws2 As Worksheet, ws3 As Worksheet, ws4 As Worksheet
Dim irow As Long, orow As Long
Dim Lastrow As Long

Dim wsname As String
Dim wsnum As String

Set ws1 = Worksheets("LIST")
Set ws2 = Worksheets("N0_TEMP")

With ws1

Lastrow = .Cells(Rows.Count, 1).End(xlUp).Row

For irow = 2 To Lastrow
wsname = .Cells(irow, 1)
wsnum = .Cells(irow, 2)
Sheets("N0_TEMP").Copy After:=Sheets(Sheets.Count)
ActiveSheet.Name = wsname
ActiveSheet.Range("E5") = wsnum

Next irow

End With
Application.Calculation = xlAutomatic
End Sub
------

sure this is very simple for the group...
TIA
--
regards,
from someone

*****
- dive with Jonathan Seagull


Tom Ogilvy

macro populated sheets is very good yet something i may miss here.
 
Why not apply the filter to noTemp before you run the macro or as the first
part of the macro.

To get code to apply the filter, then turn on the macro recorder while you
apply it once manually.

--
Regards,
Tom Ogilvy


"driller" wrote:

Hi to someone,
Please help !

the template sheet i have has an autofilter on a range...

on one of the filter along column A...
it is set-up this way
custom
show rows where
"is greater than" [i put zero] 0.

i need to incorporate a *code* to auto-refresh or repeat the set-up again on
the same location on each populated sheets...
show rows where
"is greater than" [i put zero] 0.


---here's the brief code below:
Sub USetUp()

Application.Calculation = xlManual

Dim ws1 As Worksheet, ws2 As Worksheet, ws3 As Worksheet, ws4 As Worksheet
Dim irow As Long, orow As Long
Dim Lastrow As Long

Dim wsname As String
Dim wsnum As String

Set ws1 = Worksheets("LIST")
Set ws2 = Worksheets("N0_TEMP")

With ws1

Lastrow = .Cells(Rows.Count, 1).End(xlUp).Row

For irow = 2 To Lastrow
wsname = .Cells(irow, 1)
wsnum = .Cells(irow, 2)
Sheets("N0_TEMP").Copy After:=Sheets(Sheets.Count)
ActiveSheet.Name = wsname
ActiveSheet.Range("E5") = wsnum

Next irow

End With
Application.Calculation = xlAutomatic
End Sub
------

sure this is very simple for the group...
TIA
--
regards,
from someone

*****
- dive with Jonathan Seagull


driller

macro populated sheets is very good yet something i may miss h
 
Thanks for the good advice,

i forgot to mention that i need the populated sheets to get hidden...
0-xlsheethidden<<


i dont know what kinda brief line i have to insert in the code "for the
populated sheets..." only...

---here again is the code..

Sub USetUp()

Application.Calculation = xlManual

Dim ws1 As Worksheet, ws2 As Worksheet, ws3 As Worksheet, ws4 As Worksheet
Dim irow As Long, orow As Long
Dim Lastrow As Long

Dim wsname As String
Dim wsnum As String

Set ws1 = Worksheets("LIST")
Set ws2 = Worksheets("N0_TEMP")

With ws1

Lastrow = .Cells(Rows.Count, 1).End(xlUp).Row

For irow = 2 To Lastrow
wsname = .Cells(irow, 1)
wsnum = .Cells(irow, 2)
Sheets("N0_TEMP").Copy After:=Sheets(Sheets.Count)
ActiveSheet.Name = wsname
ActiveSheet.Range("E5") = wsnum

Rows("7:290").Select
Selection.AutoFilter
Range("A7").Select
Selection.AutoFilter Field:=1, Criteria1:="0", Operator:=xlAnd
Range("A1").Select

Next irow

End With
Application.Calculation = xlAutomatic
End Sub

---------
sorry to bother, learning is quite hard and bitter when done alone...

--
regards,
from someone

*****
- dive with Jonathan Seagull



"Tom Ogilvy" wrote:

Why not apply the filter to noTemp before you run the macro or as the first
part of the macro.

To get code to apply the filter, then turn on the macro recorder while you
apply it once manually.

--
Regards,
Tom Ogilvy


"driller" wrote:

Hi to someone,
Please help !

the template sheet i have has an autofilter on a range...

on one of the filter along column A...
it is set-up this way
custom
show rows where
"is greater than" [i put zero] 0.

i need to incorporate a *code* to auto-refresh or repeat the set-up again on
the same location on each populated sheets...
show rows where
"is greater than" [i put zero] 0.


---here's the brief code below:
Sub USetUp()

Application.Calculation = xlManual

Dim ws1 As Worksheet, ws2 As Worksheet, ws3 As Worksheet, ws4 As Worksheet
Dim irow As Long, orow As Long
Dim Lastrow As Long

Dim wsname As String
Dim wsnum As String

Set ws1 = Worksheets("LIST")
Set ws2 = Worksheets("N0_TEMP")

With ws1

Lastrow = .Cells(Rows.Count, 1).End(xlUp).Row

For irow = 2 To Lastrow
wsname = .Cells(irow, 1)
wsnum = .Cells(irow, 2)
Sheets("N0_TEMP").Copy After:=Sheets(Sheets.Count)
ActiveSheet.Name = wsname
ActiveSheet.Range("E5") = wsnum

Next irow

End With
Application.Calculation = xlAutomatic
End Sub
------

sure this is very simple for the group...
TIA
--
regards,
from someone

*****
- dive with Jonathan Seagull



All times are GMT +1. The time now is 03:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com