![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Posts: 59
|
I have a macro that is opening several spreadsheets, pulling data out and pasting it into a new spreadsheet. The problem is that the tab that I am pulling from has a different name and location in each spreadsheet that I am opening. My question is, I know that I can tell the macro to prompt me as what spreadsheet to open, but can I prompt the tab also??
Or, each spreadsheet that I am opening to pull data from, while all the tabs have different names, but they have the same three letters at the end of the tab name (UPL), can I wildcard it and tell the macro to look and pull from any spreadsheet containing the letters UPL ?? I'm stumped....Any advice would be appreciated! thanks! |
|
|
|
|
|
#2 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Winnipeg
Posts: 2,330
|
Quote:
Code:
Dim ws As Worksheet
For Each ws In ActiveWorkbook
If Right(ws.Name,3) = "UPL" Then
'the rest of your code
End If
Next ws
_________________ Barrie Davidson My Excel Web Page [ This Message was edited by: Barrie Davidson on 2002-02-18 05:07 ] |
|
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Posts: 59
|
That's perfect!! Thanks!
|
|
|
|
|
|
#4 |
|
Guest
Posts: n/a
|
Pandarus gave you exactly the same reply as Barrie's (at :- htttp://www.mrexcel.com/wwwboard/messages/23147.html) when you posted this question before.
|
|
|
|
#5 |
|
Board Regular
Join Date: Feb 2002
Posts: 59
|
Sorry, I did not realize that I had already posted this before! It has been a crazy week for me...I apologize for making you read this twice!!
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|