Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

change active cell in excel

Status
Not open for further replies.

William Heath

Electrical
Apr 23, 2022
4
change active cell in excel; i know I can press Cntrl G and enter the cell to go to. To make it easier, I would like a button which could be clicked and have the spreadsheet automatically move to a different cell
Any ideas would be appreciated
 
Replies continue below

Recommended for you

Stick the command in a macro, create a button, and assign the macro to the button

This is an example macro that I used for a couple of things

Code:
Sub Macro2()

    Range("A1000000").Select
    Selection.End(xlUp).Select
    EndDate = ActiveCell.Value
    
    Sheets("BP Full Chart").Select
    ActiveChart.Axes(xlCategory).MaximumScale = EndDate + 3

    
    Sheets("BP Chart").Select
    ActiveChart.Axes(xlCategory).MaximumScale = EndDate + 0.25
    ActiveChart.Axes(xlCategory).MinimumScale = Round(EndDate) - 10
    
    ActiveWorkbook.Save
End Sub


TTFN (ta ta for now)
I can do absolutely anything. I'm an expert! faq731-376 forum1529 Entire Forum list
 
William,

There are so many places to go and so little time!

You need to look at Named Ranges. If you have a location in mind, it ought to have been given a name and then by accessing the Name Box, you will be able to select ANY of your Named Ranges.

I would, however, respectfully take exception to IRstuff. I always avoid using Select and Activate with the exception of leaving a Procedure, where you might want the display/activecell to be a specific workbook, worksheet, cell.

Select and Activate are commands that slow down your process. And each DOT level in a statement takes time to process, which is a reason to use With...End With.

Code:
Sub Macro2()

'We're not sure what worksheet we are on to get the EndDate. Would be better to identify   
    EndDate = Range("A1000000").End(xlUp).Value

'These worksheets do NOT need to be Activated in order to access their data    
    Sheets("BP Full Chart").Axes(xlCategory).MaximumScale = EndDate + 3

    
    With Sheets("BP Chart")
        With .Axes(xlCategory)
            .MaximumScale = EndDate + 0.25
            .MinimumScale = Round(EndDate) - 10
        End With
    End With

'I'm assuming that this procedure is located in the workbook that is being saved   
    ThisWorkbook.Save
End Sub

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
 
I found that I could do what I wanted using Hyperlinks. Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor