Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default edit sheet name

Background
I'm using EXCEL to convert electrical data formats and perform
analysis. We do this in steps and like to include the labels RAW and
PREP ant the end of the worksheet name (tab). We protect those sheets
and make copies of the them for analysis so we don't screw up the raw
and prepared data. I am trying to automate the data preparation
process and am having some trouble with tab naming.

Problem
To prep the raw data we use
Public Sub ProtectRaw()

Dim oldName

'copy original sheet name
oldName = ActiveSheet.Name

'add RAW to the end of the worksheet name
ActiveSheet.Name = oldName & "_RAW"

'Protect worksheet
ActiveSheet.Protect

End Sub

Works fine

This code makes a new sheet, prepares the data, protects it and adds
PREP to the sheet name:

Public Sub PrepData()
Dim sourceName

'copy original sheet name
sourceName = ActiveSheet.Name

'create new workesheet
ActiveSheet.Copy Befo=ActiveSheet

'UnProtect new worksheet
ActiveSheet.Unprotect

'Run data prep procedure
ConvPMFLTS1_Main

'modify the new worksheet name
ActiveSheet.Name = sourceName & "_PREP"

'UnProtect new worksheet
ActiveSheet.protect

End Sub
Everything works except the sheet name is "sheetname _RAW_PREP" and
I need to remove "_RAW" from the name at the end of my code. How
do I do that?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 120
Default edit sheet name

Instead of :

oldname = activesheet.name

use:

oldName = Left(ActiveSheet.Name, Len(ActiveSheet.Name) - 5)

This will take off the last 5 characters, or the "_PREP".

Cheers,
Jason Lepack


wrote:
Background
I'm using EXCEL to convert electrical data formats and perform
analysis. We do this in steps and like to include the labels RAW and
PREP ant the end of the worksheet name (tab). We protect those sheets
and make copies of the them for analysis so we don't screw up the raw
and prepared data. I am trying to automate the data preparation
process and am having some trouble with tab naming.

Problem
To prep the raw data we use
Public Sub ProtectRaw()

Dim oldName

'copy original sheet name
oldName = ActiveSheet.Name

'add RAW to the end of the worksheet name
ActiveSheet.Name = oldName & "_RAW"

'Protect worksheet
ActiveSheet.Protect

End Sub

Works fine

This code makes a new sheet, prepares the data, protects it and adds
PREP to the sheet name:

Public Sub PrepData()
Dim sourceName

'copy original sheet name
sourceName = ActiveSheet.Name

'create new workesheet
ActiveSheet.Copy Befo=ActiveSheet

'UnProtect new worksheet
ActiveSheet.Unprotect

'Run data prep procedure
ConvPMFLTS1_Main

'modify the new worksheet name
ActiveSheet.Name = sourceName & "_PREP"

'UnProtect new worksheet
ActiveSheet.protect

End Sub
Everything works except the sheet name is "sheetname _RAW_PREP" and
I need to remove "_RAW" from the name at the end of my code. How
do I do that?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 55
Default edit sheet name

Worked perfect Jason
Thanks!


Jason Lepack wrote:
Instead of :

oldname = activesheet.name

use:

oldName = Left(ActiveSheet.Name, Len(ActiveSheet.Name) - 5)

This will take off the last 5 characters, or the "_PREP".

Cheers,
Jason Lepack


wrote:
Background
I'm using EXCEL to convert electrical data formats and perform
analysis. We do this in steps and like to include the labels RAW and
PREP ant the end of the worksheet name (tab). We protect those sheets
and make copies of the them for analysis so we don't screw up the raw
and prepared data. I am trying to automate the data preparation
process and am having some trouble with tab naming.

Problem
To prep the raw data we use
Public Sub ProtectRaw()

Dim oldName

'copy original sheet name
oldName = ActiveSheet.Name

'add RAW to the end of the worksheet name
ActiveSheet.Name = oldName & "_RAW"

'Protect worksheet
ActiveSheet.Protect

End Sub

Works fine

This code makes a new sheet, prepares the data, protects it and adds
PREP to the sheet name:

Public Sub PrepData()
Dim sourceName

'copy original sheet name
sourceName = ActiveSheet.Name

'create new workesheet
ActiveSheet.Copy Befo=ActiveSheet

'UnProtect new worksheet
ActiveSheet.Unprotect

'Run data prep procedure
ConvPMFLTS1_Main

'modify the new worksheet name
ActiveSheet.Name = sourceName & "_PREP"

'UnProtect new worksheet
ActiveSheet.protect

End Sub
Everything works except the sheet name is "sheetname _RAW_PREP" and
I need to remove "_RAW" from the name at the end of my code. How
do I do that?


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
Sheet Protection / Edit Objects Keyrookie Excel Worksheet Functions 0 December 7th 09 03:44 PM
Edit links when the sheet is protected sly Excel Discussion (Misc queries) 3 September 28th 07 02:48 AM
How do view and edit ALL hyperlinks in a sheet? jrh11 Excel Discussion (Misc queries) 0 September 15th 06 11:46 AM
Selct and edit sheet NNothard Excel Discussion (Misc queries) 2 August 14th 06 05:21 PM
Using Ref edit in Add in to save to a different sheet. c4clark Excel Programming 1 March 11th 06 09:09 PM


All times are GMT +1. The time now is 04:35 AM.

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"