Thread: Help with code
View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Don Guillett[_2_] Don Guillett[_2_] is offline
external usenet poster
 
Posts: 1,522
Default Help with code

Sub SimpleAddSheetandNameforCell()
sheets.Add(After:=Sheets(Sheets.Count)).Name = range("n7")
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Ronbo" wrote in message
...
With the following code I get the error message " "Type mismatch" on "Set
s2". What am I doing wrong?

Dim s1 As Worksheet, s2 As Worksheet
Dim sName As String

sName = Range("n7")
Worksheets.Add(After:=Sheets(Sheets.Count)).Name =
ActiveSheet.Range("n7").Value

Set s1 = ActiveSheet
Set s2 = sName

Thanks,
Ronbo