Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default FILTER SHEETS BY NAME

how can a piece of code be run on every sheet whose name that begins with
"buy", in a particular workbook ?

Thanks in anticipation

Sunil


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default FILTER SHEETS BY NAME

Hi
try something like the following:
sub foo()
dim wks as worksheet
for each wks in activeworkbook.worksheets
if lcase(left(wks.name,3))="buy" then
msgbox wks.range("A1").value
'your code
end if
next
end sub

--
Regards
Frank Kabel
Frankfurt, Germany


SUNIL wrote:
how can a piece of code be run on every sheet whose name that begins
with "buy", in a particular workbook ?

Thanks in anticipation

Sunil

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default FILTER SHEETS BY NAME

Try something like

Dim WS As Worksheet
For Each WS In ActiveWorkbook.Worksheets
If WS.Name Like "Buy*" Then
' do something with WS
End If
Next WS


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"SUNIL" wrote in message
...
how can a piece of code be run on every sheet whose name that

begins with
"buy", in a particular workbook ?

Thanks in anticipation

Sunil




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default FILTER SHEETS BY NAME

try this
for each ws in worksheets
if left(ws.name,3)="buy" then runmycode
next ws

--
Don Guillett
SalesAid Software

"SUNIL" wrote in message
...
how can a piece of code be run on every sheet whose name that begins with
"buy", in a particular workbook ?

Thanks in anticipation

Sunil




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hyperlink and Filter Data in Multiple Sheets Sheikh Saadi Excel Discussion (Misc queries) 0 March 13th 09 07:02 AM
Filter Across Multiple Sheets Scott Halper Excel Worksheet Functions 1 January 22nd 08 05:04 PM
Excel filter over multiple sheets botto Excel Worksheet Functions 0 July 4th 06 11:34 AM
Retroactive filter between two sheets? [email protected] Excel Discussion (Misc queries) 1 October 13th 05 01:55 PM
FILTER ONE MULTIPLE SHEETS ANDRIP Excel Worksheet Functions 1 March 15th 05 01:43 AM


All times are GMT +1. The time now is 06:55 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"