ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Command Buttons & ActiveX Controls (https://www.excelbanter.com/excel-discussion-misc-queries/213916-re-command-buttons-activex-controls.html)

aussiegirlone

Command Buttons & ActiveX Controls
 
Dave Peterson/Bob Phillips

My apologies for not responding sooner as I was not home last night. The
Code you provided below works well Thankyou very much.
However, I would like to rename my worksheet (sheet1) to
(IncidentDesription) but doing so, stops the Code below from working. so how
can I rename the sheet to have it work with my commandbutton

Public Sub MyButton_Click()
application.goto Worksheets("Sheet2").range("X99"), scroll:=true 'or
false??
End Sub


Dave Peterson

Command Buttons & ActiveX Controls
 
If you wrote that Sheet2 was renamed, then you'd have to change this line:

application.goto Worksheets("Sheet2").range("X99"), scroll:=true
to
application.goto Worksheets("IncidentDesription").range("X99"), scroll:=true

But I don't know why you're having trouble when you change the name of
Sheet1--sheet1 is the name of the sheet that contains the commandbutton, right?

(And remember to change x99 to the address of the cell that you want to go to.)

aussiegirlone wrote:

Dave Peterson/Bob Phillips

My apologies for not responding sooner as I was not home last night. The
Code you provided below works well Thankyou very much.
However, I would like to rename my worksheet (sheet1) to
(IncidentDesription) but doing so, stops the Code below from working. so how
can I rename the sheet to have it work with my commandbutton

Public Sub MyButton_Click()
application.goto Worksheets("Sheet2").range("X99"), scroll:=true 'or
false??
End Sub


--

Dave Peterson

aussiegirlone

Command Buttons & ActiveX Controls
 
I had done that but I get a meesage (run-time error 9 Subscript out of range)

"Dave Peterson" wrote:

If you wrote that Sheet2 was renamed, then you'd have to change this line:

application.goto Worksheets("Sheet2").range("X99"), scroll:=true
to
application.goto Worksheets("IncidentDesription").range("X99"), scroll:=true

But I don't know why you're having trouble when you change the name of
Sheet1--sheet1 is the name of the sheet that contains the commandbutton, right?

(And remember to change x99 to the address of the cell that you want to go to.)

aussiegirlone wrote:

Dave Peterson/Bob Phillips

My apologies for not responding sooner as I was not home last night. The
Code you provided below works well Thankyou very much.
However, I would like to rename my worksheet (sheet1) to
(IncidentDesription) but doing so, stops the Code below from working. so how
can I rename the sheet to have it work with my commandbutton

Public Sub MyButton_Click()
application.goto Worksheets("Sheet2").range("X99"), scroll:=true 'or
false??
End Sub


--

Dave Peterson


aussiegirlone

Command Buttons & ActiveX Controls
 
Dave it worked Renaming the work sheet and the goto fixed the problem
thankyou very much.

"Dave Peterson" wrote:

If you wrote that Sheet2 was renamed, then you'd have to change this line:

application.goto Worksheets("Sheet2").range("X99"), scroll:=true
to
application.goto Worksheets("IncidentDesription").range("X99"), scroll:=true

But I don't know why you're having trouble when you change the name of
Sheet1--sheet1 is the name of the sheet that contains the commandbutton, right?

(And remember to change x99 to the address of the cell that you want to go to.)

aussiegirlone wrote:

Dave Peterson/Bob Phillips

My apologies for not responding sooner as I was not home last night. The
Code you provided below works well Thankyou very much.
However, I would like to rename my worksheet (sheet1) to
(IncidentDesription) but doing so, stops the Code below from working. so how
can I rename the sheet to have it work with my commandbutton

Public Sub MyButton_Click()
application.goto Worksheets("Sheet2").range("X99"), scroll:=true 'or
false??
End Sub


--

Dave Peterson


Dave Peterson

Command Buttons & ActiveX Controls
 
If you renamed the worksheet and the code worked, then you probably either had a
typo on the tab of the worksheet or a typo in the code.

To most programmers, typos aren't important--as long as they match every place
they're used <vbg!

aussiegirlone wrote:

Dave it worked Renaming the work sheet and the goto fixed the problem
thankyou very much.

"Dave Peterson" wrote:

If you wrote that Sheet2 was renamed, then you'd have to change this line:

application.goto Worksheets("Sheet2").range("X99"), scroll:=true
to
application.goto Worksheets("IncidentDesription").range("X99"), scroll:=true

But I don't know why you're having trouble when you change the name of
Sheet1--sheet1 is the name of the sheet that contains the commandbutton, right?

(And remember to change x99 to the address of the cell that you want to go to.)

aussiegirlone wrote:

Dave Peterson/Bob Phillips

My apologies for not responding sooner as I was not home last night. The
Code you provided below works well Thankyou very much.
However, I would like to rename my worksheet (sheet1) to
(IncidentDesription) but doing so, stops the Code below from working. so how
can I rename the sheet to have it work with my commandbutton

Public Sub MyButton_Click()
application.goto Worksheets("Sheet2").range("X99"), scroll:=true 'or
false??
End Sub


--

Dave Peterson


--

Dave Peterson


All times are GMT +1. The time now is 08:03 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com