View Single Post
 
Old 07-02-2014, 09:49 AM
chrisd2000 chrisd2000 is offline Windows 7 64bit Office 2007
Novice
 
Join Date: Jun 2014
Posts: 16
chrisd2000 is on a distinguished road
Default To me the code on the youtube tutorial looks the same as mine but a I get a run-time

The error message also says "Method 'worksheets' of object '_global' " failed. When I run the debug tool, it highlights Worksheets.Add in yellow (see link) Here is an image of the tutorial's code http://imgur.com/MEBrD8Y Here is an image of my code http://imgur.com/COs34K1

Here is the code:

Sub CreateAndLabelNewSheet()

'create worksheet
'object.Method

Worksheets.Add
'add titles to cells'

'object.property = value'
Range("A1").Value = "Created By"
Range("A2").Value = "Created on"
Range("A3").Value = "Version"

'add user values to cells
Range("B1").Value = Environ("UserName")
Range("B2").Value = Date
Range("B3").Value = 1

'format titles
Range("a1:a3").Font.Color = vbBlue

Range("a1:a3").Interior.Color = rgbAliceBlue

End Sub
Reply With Quote