Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi. I created a Macro to take a excell file (lets same its named Doggy),
sort and break up per my specs and place results on 7 different tabs. Works good. However everytime I get a new file to convert through this Macro I have to rename the file to Doggy before the macroo will work because that is the name on the tab when I origionally created the macro. Here is the line that is causing the issue - Sheets("Doggy").Select . is there a way around this? Thanks |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
hi,
when you "get a new file" is this a new file or an existing one that someone sent to you? If a new file, how many sheets do you start with? by default, new files have the first sheet as "sheet1". perhaps you could use sheet1 in the macro and rename the sheet later to batty or hippopotamusy or what ever if needed. if only one sheet in the new file, then play a mind game with it. For each sheet in activeworkbook run macro next if no other sheets, you are out of the loop. end sub. thought? FSt1 "Jim" wrote: Hi. I created a Macro to take a excell file (lets same its named Doggy), sort and break up per my specs and place results on 7 different tabs. Works good. However everytime I get a new file to convert through this Macro I have to rename the file to Doggy before the macroo will work because that is the name on the tab when I origionally created the macro. Here is the line that is causing the issue - Sheets("Doggy").Select . is there a way around this? Thanks |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sorry, the file is one that has been sent to me that I open and convert so
the name on the tab would be whatever the file name is. "FSt1" wrote: hi, when you "get a new file" is this a new file or an existing one that someone sent to you? If a new file, how many sheets do you start with? by default, new files have the first sheet as "sheet1". perhaps you could use sheet1 in the macro and rename the sheet later to batty or hippopotamusy or what ever if needed. if only one sheet in the new file, then play a mind game with it. For each sheet in activeworkbook run macro next if no other sheets, you are out of the loop. end sub. thought? FSt1 "Jim" wrote: Hi. I created a Macro to take a excell file (lets same its named Doggy), sort and break up per my specs and place results on 7 different tabs. Works good. However everytime I get a new file to convert through this Macro I have to rename the file to Doggy before the macroo will work because that is the name on the tab when I origionally created the macro. Here is the line that is causing the issue - Sheets("Doggy").Select . is there a way around this? Thanks |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sorry, the file is one that has been sent to me that I open and convert so
the name on the tab would be whatever the file name is. I start with one tab but have 8 when I am done converting the information. Thank you. "FSt1" wrote: hi, when you "get a new file" is this a new file or an existing one that someone sent to you? If a new file, how many sheets do you start with? by default, new files have the first sheet as "sheet1". perhaps you could use sheet1 in the macro and rename the sheet later to batty or hippopotamusy or what ever if needed. if only one sheet in the new file, then play a mind game with it. For each sheet in activeworkbook run macro next if no other sheets, you are out of the loop. end sub. thought? FSt1 "Jim" wrote: Hi. I created a Macro to take a excell file (lets same its named Doggy), sort and break up per my specs and place results on 7 different tabs. Works good. However everytime I get a new file to convert through this Macro I have to rename the file to Doggy before the macroo will work because that is the name on the tab when I origionally created the macro. Here is the line that is causing the issue - Sheets("Doggy").Select . is there a way around this? Thanks |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Change Sheets("Doggy") to Sheets(1)
-- Regards, Tom Ogilvy "Jim" wrote: Sorry, the file is one that has been sent to me that I open and convert so the name on the tab would be whatever the file name is. I start with one tab but have 8 when I am done converting the information. Thank you. "FSt1" wrote: hi, when you "get a new file" is this a new file or an existing one that someone sent to you? If a new file, how many sheets do you start with? by default, new files have the first sheet as "sheet1". perhaps you could use sheet1 in the macro and rename the sheet later to batty or hippopotamusy or what ever if needed. if only one sheet in the new file, then play a mind game with it. For each sheet in activeworkbook run macro next if no other sheets, you are out of the loop. end sub. thought? FSt1 "Jim" wrote: Hi. I created a Macro to take a excell file (lets same its named Doggy), sort and break up per my specs and place results on 7 different tabs. Works good. However everytime I get a new file to convert through this Macro I have to rename the file to Doggy before the macroo will work because that is the name on the tab when I origionally created the macro. Here is the line that is causing the issue - Sheets("Doggy").Select . is there a way around this? Thanks |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
To add to my original post:
Using Sheets(1) vice Sheets("Doggy") assumes that when you add sheets, you add them after the orginal sheet. if that isn't the case, you can add a line at the top of your macro Sheets(1).Name = "Doggy" or you can use the book name since you say they are the same sheets(Left(activeworkbook.name,len(activeworkbook .name)-4).Select -- Regards, Tom Ogilvy "Jim" wrote: Sorry, the file is one that has been sent to me that I open and convert so the name on the tab would be whatever the file name is. I start with one tab but have 8 when I am done converting the information. Thank you. "FSt1" wrote: hi, when you "get a new file" is this a new file or an existing one that someone sent to you? If a new file, how many sheets do you start with? by default, new files have the first sheet as "sheet1". perhaps you could use sheet1 in the macro and rename the sheet later to batty or hippopotamusy or what ever if needed. if only one sheet in the new file, then play a mind game with it. For each sheet in activeworkbook run macro next if no other sheets, you are out of the loop. end sub. thought? FSt1 "Jim" wrote: Hi. I created a Macro to take a excell file (lets same its named Doggy), sort and break up per my specs and place results on 7 different tabs. Works good. However everytime I get a new file to convert through this Macro I have to rename the file to Doggy before the macroo will work because that is the name on the tab when I origionally created the macro. Here is the line that is causing the issue - Sheets("Doggy").Select . is there a way around this? Thanks |
#7
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Jim,
Try using ActiveWorkbook. By the way, it is seldome necessary, or desirable, to select object; It is usually possible to manipulate an object variable rather than making a physical selection. --- Regards, Norman "Jim" wrote in message ... Hi. I created a Macro to take a excell file (lets same its named Doggy), sort and break up per my specs and place results on 7 different tabs. Works good. However everytime I get a new file to convert through this Macro I have to rename the file to Doggy before the macroo will work because that is the name on the tab when I origionally created the macro. Here is the line that is causing the issue - Sheets("Doggy").Select . is there a way around this? Thanks |
#8
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Set StartSheet = Activesheet
'your code StartSheet.Activate -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Jim" wrote in message ... Hi. I created a Macro to take a excell file (lets same its named Doggy), sort and break up per my specs and place results on 7 different tabs. Works good. However everytime I get a new file to convert through this Macro I have to rename the file to Doggy before the macroo will work because that is the name on the tab when I origionally created the macro. Here is the line that is causing the issue - Sheets("Doggy").Select . is there a way around this? Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel should have tabs at the top for different files | Setting up and Configuration of Excel | |||
hiden tabs & macros | Excel Discussion (Misc queries) | |||
Running macros on ALL Excel tabs | Excel Worksheet Functions | |||
macros won't work when tabs with data used are hidden | Excel Programming | |||
locking tabs w/macros | Excel Discussion (Misc queries) |