VBA Debug: Workbook Open Rnage....Activate

gheyman

Well-known Member
Joined
Nov 14, 2005
Messages
1,732
Office Version
2016
Platform
Windows
IT doesn't like
Sheet1.Range("C16").Activate


Code:
Private Sub Workbook_Open()
    Sheet1.Range("C16").Value = Environ("Username")
    Sheet1.Range("C17").Value = Now
        Sheet1.Range("C21").NumberFormat = "m/d/yyyy h:mm"
    Sheet1.Range("C16").Activate
    
End Sub

[Code/]
[Code\]

Thnaks
 
Last edited:

Some videos you may like

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
42,721
Office Version
365
Platform
Windows
You have to activate the sheet, before you activate the cell.
Alternatively use Application.Goto
 

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
12,198
Office Version
2007
Platform
Windows
What do you need to activate the cell for?
Generally it is to get its value and for that you do not need to select the cell you can have this:

Code:
wValue = [COLOR=#333333]Sheet1.Range("C16").Value[/COLOR]
 

Watch MrExcel Video

Forum statistics

Threads
1,102,435
Messages
5,486,855
Members
407,567
Latest member
spinitback

This Week's Hot Topics

Top