Question : Command button code

Would anyone know a command button code that would be able to jump to a particular cell?

For instance I was just creating a worksheet and it would be beneficial to jump to a particular cell in a workbook so you could look up additional information.

For instance I am in Cell C11 and then hit the command button and this takes me to Cell A45

Also could I do the same but jump to another tab on an excel spreadsheet. i.e Cell A45 but sheet 2

Many thanks
Gaz

Answer : Command button code

Public Sub GoToEntryCell()
   [A45].Select
End Sub

To add VBA code to a regular or general module in an Excel workbook, press ALT+F11 to open the VBA development environment (VBE). Select the menu command Insert->Module to create a new VBA module. Paste the code into the document window that appears. Press ALT+F11 to return to the Excel workbook.

To add a command button to a worksheet that runs a macro, right-click on the menu bar and select Forms. Click on the gray rectangle icon. With the mouse, click where the upper left corner of the command button is to be placed and drag the mouse down and to the right to create the shape of the command button. A dialog is displayed asking for the macro to run when the command button is clicked. Select the desired macro and click the OK command button. If the macro is Private then it won't be listed but it can still be attached to the command button by manually entering its name.

Kevin
Random Solutions  
 
programming4us programming4us