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

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

dk

MrExcel MVP
Joined
Feb 15, 2002
Messages
2,942
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
 

Smitty

Legend
Joined
May 15, 2003
Messages
29,536
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
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,151,876
Messages
5,766,875
Members
425,383
Latest member
IllDo

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
Top