Display difference specific range of cell in the same worksheet by clicking button in VBA

Copper Contributor

Hi There.

I'm new here. Just learning VBA to create some records for my own personal use. Can anyone share with me the codes on how to display a specific range of cells within the same worksheet?

For example, if I click button A, the coding will lead me and display only the range of cells from A1:O26 and if I click button B, the coding will allow me to display only the range of P1:AD26.

 

Any ideas guys? Thanks in advance

1 Reply

@Tariq_Rahmalan 

 

Here's an example

 

 

Option Explicit

Private Sub CommandButton1_Click()
Dim wks As Worksheet
    Set wks = ThisWorkbook.Worksheets("Tabelle1")
    Application.Goto wks.Range("A1:O26"), True
End Sub

 
Private Sub CommandButton2_Click()
Dim wks As Worksheet
    Set wks = ThisWorkbook.Worksheets("Tabelle1")
    Application.Goto wks.Range("P1:AD26"), True
End Sub

 

 

I would be happy to know if I could help.

 

Nikolino

I know I don't know anything (Socrates)

 

* Kindly Mark and Vote this reply if it helps please, as it will be beneficial to more Community members reading here.