Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Conditional formatting - getting input from another cell | Excel Worksheet Functions | |||
input # on sheet 1, pulls all info for # from sheet 2 | Setting up and Configuration of Excel | |||
input conditional formulas using VBA Macro in axcel sheet | Excel Discussion (Misc queries) | |||
Conditional Date Input... | Excel Discussion (Misc queries) | |||
I want data on sheet 1 to input into sheet 2 also | Excel Worksheet Functions |