If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Setforcus

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-06-06, 19:48
accessman2 accessman2 is offline
Registered User
 
Join Date: Sep 2005
Posts: 313
Setforcus

Hi,

In VB,

How can I set forcus in the cells?

Because I cannot find the setforcus function in VB.

worksheets("sheet1").range("A10").setforcus

Thanks.
Reply With Quote
  #2 (permalink)  
Old 09-06-06, 20:33
savbill savbill is offline
Registered User
 
Join Date: Feb 2004
Posts: 533
"SetFocus" is not a Method of Worksheet, Range, Cell objects. You want to use either the "Select" or "Activate" Method.
SetFocus is only used with UserForm Objects.

Range("A10").Activate

Worksheets("Sheet1").Select
Worksheets("Sheet1").Range("A10").Select

Range("A10").Offset(0,3).Select

Do you know you can put your cursor on the word "Range" in the VB Editor and press the F1 Key to open MS Help to list all the events and Methods?

From Excel Help:
To select a cell or a range of cells, use the Select method. To make a single cell the active cell, use the Activate method.

Example
This example selects cells A1:B3 on Sheet1.

Worksheets("Sheet1").Activate
Range("A1:B3").Select
__________________
~

Bill
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On