VB Help

StillLearning

New Member
Joined
Feb 8, 2004
Messages
8
Hi,
I just a new member here. I need to ask how to use VB in excel?
When open the excel worksheet it automatic go to worksheet I need.

Second thing what book is good in for a new user like me specially in VB in excel.

Thank you
:eek:
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Hi, and welcome to the board!

Try these steps for doing what you need:-

1. Open the Visual Basic Editor and click Ctrl-R to show the Project Explorer.
2. Locate your project in the Project Explorer window and expand the tree if necessary.
3. Double-click the ThisWorkbook icon and paste this code:-

Code:
Private Sub Workbook_Open()
Sheets("Sheet1").Activate
End Sub

Change 'Sheet1' to whatever your sheet is called.

As for good books, I can recommend John Walkenbach's Excel Power Programming - see http://www.j-walk.com/ss/books/index.htm and I've heard that Bill Jelen (Mr Excel) has written some good stuff - see http://www.mrexcel.com/board2/viewforum.php?f=15
 
Upvote 0
Welcome to the Board!

What Dan said notwithstanding, one of the best ways to learn to use VB in Excel (or any other Office program), is to record some macros and study the code that is generated.

2 caveats here though: VBA will generate a lot of erroneous code as it essentially records your every move, so there will be plenty to pare down. I.E.
Code:
ActiveWindow.LargeScroll Down:=1
    Range("A32").Select
    ActiveWindow.LargeScroll Down:=1
    Range("A63").Select
    Selection.End(xlToRight).Select
    Range("E3").Select
Can simply be Range("E3").Select. Although it should be Application.Goto Reference:=['Sheet1'!A1]. (Note that where possible, get rid of select statements).

Second is that there is a lot of code that VBA will not generate that will require you to write some yourself. Searching the board will generally give you a lot of great leads and ideas.

Hope that helps,

Smitty
 
Upvote 0

Forum statistics

Threads
1,214,970
Messages
6,122,514
Members
449,088
Latest member
RandomExceller01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top