Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Jim Jim is offline
external usenet poster
 
Posts: 615
Default Macros Tabs and Files

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,942
Default Macros Tabs and Files

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   Report Post  
Posted to microsoft.public.excel.programming
Jim Jim is offline
external usenet poster
 
Posts: 615
Default Macros Tabs and Files

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   Report Post  
Posted to microsoft.public.excel.programming
Jim Jim is offline
external usenet poster
 
Posts: 615
Default Macros Tabs and Files

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Macros Tabs and Files

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Macros Tabs and Files

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Macros Tabs and Files

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Macros Tabs and Files

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
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
Excel should have tabs at the top for different files Chris R[_2_] Setting up and Configuration of Excel 0 February 25th 10 08:00 PM
hiden tabs & macros PG Excel Discussion (Misc queries) 2 September 1st 06 09:54 PM
Running macros on ALL Excel tabs tbong Excel Worksheet Functions 1 June 7th 06 08:52 PM
macros won't work when tabs with data used are hidden pywhacket Excel Programming 5 March 22nd 06 08:21 PM
locking tabs w/macros erik Excel Discussion (Misc queries) 2 July 6th 05 05:21 PM


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

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

About Us

"It's about Microsoft Excel"