ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   looping thru each w/sheet (https://www.excelbanter.com/excel-programming/348982-looping-thru-each-w-sheet.html)

[email protected]

looping thru each w/sheet
 
Hi,

I'm looking to loop through each ws in the current workbook and, for
each w/sheet, programatically get the highest value in one of the
columns, count the number of occurrences of a cartain variable in
another column and return these values programatically so I can create
a Front Page type of thing.

I think I understand how to get the list of worksheets i'ts after that
I get stuck...I've no idea how to reference cells in a worksheet from
within vba.

also....

is it possible to run the code I create ONLY when a certain cell value
is changed on the Front PAge???

TIA


Bob Phillips[_6_]

looping thru each w/sheet
 
For Each sh In Activeworkbook.Worksheets
myVar = sh.Range("A1")
myCount = Application.COUNTIF(Columns(3),"abc")
'do something with these values
Next sh

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

wrote in message
oups.com...
Hi,

I'm looking to loop through each ws in the current workbook and, for
each w/sheet, programatically get the highest value in one of the
columns, count the number of occurrences of a cartain variable in
another column and return these values programatically so I can create
a Front Page type of thing.

I think I understand how to get the list of worksheets i'ts after that
I get stuck...I've no idea how to reference cells in a worksheet from
within vba.

also....

is it possible to run the code I create ONLY when a certain cell value
is changed on the Front PAge???

TIA




Dave Peterson

looping thru each w/sheet
 
I think Bob wanted:

myCount = Application.COUNTIF(sh.Columns(3),"abc")

(just to make sure he was using column 3 on sheet sh.)

If the cell changes because of a typing change, then you could tie into the
worksheet_change event.

If you want to read more about these kinds of events:

Chip Pearson's site:
http://www.cpearson.com/excel/events.htm

David McRitchie's site:
http://www.mvps.org/dmcritchie/excel/event.htm


Bob Phillips wrote:

For Each sh In Activeworkbook.Worksheets
myVar = sh.Range("A1")
myCount = Application.COUNTIF(Columns(3),"abc")
'do something with these values
Next sh

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

wrote in message
oups.com...
Hi,

I'm looking to loop through each ws in the current workbook and, for
each w/sheet, programatically get the highest value in one of the
columns, count the number of occurrences of a cartain variable in
another column and return these values programatically so I can create
a Front Page type of thing.

I think I understand how to get the list of worksheets i'ts after that
I get stuck...I've no idea how to reference cells in a worksheet from
within vba.

also....

is it possible to run the code I create ONLY when a certain cell value
is changed on the Front PAge???

TIA


--

Dave Peterson

Bob Phillips[_6_]

looping thru each w/sheet
 
Thanks Dave.

Bob

(remove nothere from email address if mailing direct)

"Dave Peterson" wrote in message
...
I think Bob wanted:

myCount = Application.COUNTIF(sh.Columns(3),"abc")

(just to make sure he was using column 3 on sheet sh.)

If the cell changes because of a typing change, then you could tie into

the
worksheet_change event.

If you want to read more about these kinds of events:

Chip Pearson's site:
http://www.cpearson.com/excel/events.htm

David McRitchie's site:
http://www.mvps.org/dmcritchie/excel/event.htm


Bob Phillips wrote:

For Each sh In Activeworkbook.Worksheets
myVar = sh.Range("A1")
myCount = Application.COUNTIF(Columns(3),"abc")
'do something with these values
Next sh

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

wrote in message
oups.com...
Hi,

I'm looking to loop through each ws in the current workbook and, for
each w/sheet, programatically get the highest value in one of the
columns, count the number of occurrences of a cartain variable in
another column and return these values programatically so I can create
a Front Page type of thing.

I think I understand how to get the list of worksheets i'ts after that
I get stuck...I've no idea how to reference cells in a worksheet from
within vba.

also....

is it possible to run the code I create ONLY when a certain cell value
is changed on the Front PAge???

TIA


--

Dave Peterson





All times are GMT +1. The time now is 10:49 PM.

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