View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
lonnierudd via OfficeKB.com lonnierudd via OfficeKB.com is offline
external usenet poster
 
Posts: 26
Default Trimming worksheet name from an imported data source

The database I'm pulling the worksheet from comes from a vendor, and it
automatically assigns the worksheet name. What I'm looking for is to be able
to have a macro pull the new numbers each month after I've loaded the new
tables. There are 80+ different vehicles I pull this information on, so
unless we can get the vendor to give us the data with a consistent name, not
likely, then I need to be able to put it into a consistent form so that the
worksheets with all the calculations on them will update correctly when the
tables themselves are updated. Does that help? So if it'll trim 12 characters
off the left side of the worksheet name, then I'd be good. I'd just repeat
that on all 80+ worksheets that I need to trim. Trimming from the right would
mean different code for each page since there's lots of different types of
vehicles.


Rick Rothstein (MVP - VB) wrote:
I'm not totally clear on what you are asking. Do you want to know how to
change the first 2 characters of a string of text? If your string is in a
variable named, say, TabName so that currently,

TabName = "JA_20082008_CHRYSLER_300_SERIES"

and you want to change this to start with AS, then there are two ways you
can do this...

1) TabName = "AS" & Mid(TabName, 3)

2) Mid$(TabName, 2) = "AS"

You could then assign the TabName back to the tab. If you are asking
something else, them I think you will have to provide us with more details.

Rick

I'm bringing in data from an external source that changes each month, and
to

[quoted text clipped - 9 lines]
Next month the JA will be replaced with AS for August/September. I really
would appreciate your help.


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200807/1