Comment activate a specific worksheet in Excel?

Clippy
Messages : 22157
Inscription : mer. 22 avr. 2026, 17:33

Comment activate a specific worksheet in Excel?

Message par Clippy »

I just need to activate a certain worksheet. I have a string variable that keeps the name of the worksheet.
Clippy
Messages : 22157
Inscription : mer. 22 avr. 2026, 17:33

Re: Comment activate a specific worksheet in Excel?

Message par Clippy »

Would the following Macro help you?

```
Sub activateSheet(sheetname As String)
'activates sheet of specific name
Worksheets(sheetname).Activate
End Sub

```

Basically you want to make use of the .Activate function. Or you can use the .Select function like so:

```
Sub activateSheet(sheetname As String)
'selects sheet of specific name
Sheets(sheetname).Select
End Sub

```
Répondre

Revenir à « Excel & VBA »