Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default conditional input box for sheet name

Hello

I created macro which works perfectly (thanks to this site also).
The only problem is that during running of that macro new worksheets are
created and named after string in particular cells.
It happens sometimes that string is that cell contains invalid characters or
is too long and stops the macro. Cells are always in the same colums so I
warned people using this macro to check before running it if this colums
contains valid strings and do find/replace but you know how it is.

is it possible (I should ask 'how to') : name worksheet after string in a
cell but if it is invalid string for worksheet name display input box and
name worksheet from input box.

below is a bit of code which I have at the moment (it is inside a loop if it
matters)

Selection.Copy
Sheets("Sheet1").Select
Sheets.Add
Range("A2").Select
ActiveSheet.Paste

Cells.find(What:="descr1", After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:= _
False, SearchFormat:=False).Activate
Cells(ActiveCell.Row + 2, ActiveCell.Column).Select

ActiveSheet.Name = ActiveCell.Value



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default conditional input box for sheet name

make a little sub that will ask that

Sub NameCorrect(CellContent As String)
On Error Resume Next
ActiveSheet.Name = CellContent
Do While Err.Number 0
NewName = InputBox("Name not correct, enter new one")
Err.Clear
ActiveSheet.Name = NewName
Loop
End Sub

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
Conditional formatting - getting input from another cell EricD Excel Worksheet Functions 6 October 1st 09 05:17 PM
input # on sheet 1, pulls all info for # from sheet 2 moochx5 Setting up and Configuration of Excel 1 July 19th 06 10:43 AM
input conditional formulas using VBA Macro in axcel sheet Francesco Excel Discussion (Misc queries) 7 April 2nd 06 01:51 PM
Conditional Date Input... CMIConnie Excel Discussion (Misc queries) 2 March 6th 06 08:15 PM
I want data on sheet 1 to input into sheet 2 also walott1 Excel Worksheet Functions 2 June 23rd 05 03:56 PM


All times are GMT +1. The time now is 05:55 PM.

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"