![]() |
Project Two - Sheet Number
I have now started my 2nd VBA Excell Project...Wo Hoo! I have changed my Name for this Project. With the fllowing Sub I was trying to return the Sheet NUMBER a cell was changed on. (1, 2, 3, 4, etc) This will not work of course, because "ActiveSheet.Name" returns the sheet NAME, not Number. Anyone know how to do this? Private Sub Workbook_SheetChange() Dim cRow as Long Dim cCol as Long Dim cSheet as Long cRow = Target.Row cCol = Target.Column cSheet = ActiveSheet.Name MSGBOX cSheet End Sub |
Project Two - Sheet Number
cSheet = activesheet.index
-- HTH RP (remove nothere from the email address if mailing direct) "Barry Wright" wrote in message ... I have now started my 2nd VBA Excell Project...Wo Hoo! I have changed my Name for this Project. With the fllowing Sub I was trying to return the Sheet NUMBER a cell was changed on. (1, 2, 3, 4, etc) This will not work of course, because "ActiveSheet.Name" returns the sheet NAME, not Number. Anyone know how to do this? Private Sub Workbook_SheetChange() Dim cRow as Long Dim cCol as Long Dim cSheet as Long cRow = Target.Row cCol = Target.Column cSheet = ActiveSheet.Name MSGBOX cSheet End Sub |
Project Two - Sheet Number
try acivesheet.index
"Barry Wright" wrote: I have now started my 2nd VBA Excell Project...Wo Hoo! I have changed my Name for this Project. With the fllowing Sub I was trying to return the Sheet NUMBER a cell was changed on. (1, 2, 3, 4, etc) This will not work of course, because "ActiveSheet.Name" returns the sheet NAME, not Number. Anyone know how to do this? Private Sub Workbook_SheetChange() Dim cRow as Long Dim cCol as Long Dim cSheet as Long cRow = Target.Row cCol = Target.Column cSheet = ActiveSheet.Name MSGBOX cSheet End Sub |
Project Two - Sheet Number
Barry
Change to.....cSheet = ActiveSheet.Index Gord Dibben Excel MVP On Thu, 25 Nov 2004 14:13:39 -0500, Barry Wright wrote: I have now started my 2nd VBA Excell Project...Wo Hoo! I have changed my Name for this Project. With the fllowing Sub I was trying to return the Sheet NUMBER a cell was changed on. (1, 2, 3, 4, etc) This will not work of course, because "ActiveSheet.Name" returns the sheet NAME, not Number. Anyone know how to do this? Private Sub Workbook_SheetChange() Dim cRow as Long Dim cCol as Long Dim cSheet as Long cRow = Target.Row cCol = Target.Column cSheet = ActiveSheet.Name MSGBOX cSheet End Sub |
All times are GMT +1. The time now is 02:58 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com