Friday, September 28, 2007

next simple code sample !

'Code to set the current active cell value to something

Sub SetValue()
Worksheets("Sheet1").Activate
ActiveCell.Value = 35
End Sub

More Office Manuals ...

Dont forget to check out www.interquadbooks.co.uk for a now updated library of Computer Reference Books !


Jamie

Get your Code into Action ...

I almost forgot ....

Copy and Paste the code into the VB Editor window maybe on the first sheet or the This Workbook page, Save it !!! and then test it out by running the Code from the Run icon.


PS you could create an icon on the Toolbar to run the Macro later if you are feeling brave !!

Jamie

VBA for EXCEL Code Snippets

Hi all ,
I will be adding a little bit of code here and there to the BLOG in the form of Excel Code as I find out a little more on the subject as I go along the path to becoming a VB person !! [anorak not included]

Heres some code that uses the InputBox Function to then add a number of required additional worksheets to your Spreadsheet.

' Code to create additional Worksheets
Sub AddXWorksheets()
Dim myNum As String

myNum = Application.InputBox("Enter the number of additional WorkSheets required")
Worksheets.Add After:=Worksheets(Worksheets.Count), Count:=myNum
End Sub

Thankyou !

Search This Blog

Desktop Applications Training Blog


Jamie Johnson
JJSurf IT Training Ltd
http://www.jjsurf.co.uk/