View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Esben Esben is offline
external usenet poster
 
Posts: 1
Default Refer to a sheet in a cell

Hi

I am trying to refer to a sheet in a cell.
If the sheet does not exist, the macro will make it. Else it jus
select it.
The first part works, but i cant make it select the new sheet.

My code:

Sub Makro1()

receptnr = Sheets("Main").Range("b1")

If Not SheetExists(Sheets("Main").Range("b1")) Then
Sheets.Add
ActiveSheet.Name = receptnr
Sheets(receptnr).Select ' <-- that line causes the problem
Else
Sheets(receptnr).Select ' <-- and that one.
End If

End Sub

---

I am not very good at programming, so i may have to do this al
different. ;)

Esbe

--
Message posted from http://www.ExcelForum.com