Results 1 to 3 of 3

Thread: Basic vba doubt

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jul 2001
    Posts
    113

    Basic vba doubt

    My friend wants to move the control from cell A1 to B1 in Excel when he clicks on a command button embeded inside the excel worksheet.

    I understand that this is possible thru vba, but, im totally new to it. Can someone help my friend.

    Another thing is, should i call the excel .xls file from vb to make it run? If yes, how do i do it

    Thanx again

  2. #2
    AIS_DK
    Guest
    A good of figuring out how to do things in EXCEL or WORD (in code, that is) is to record a macro, doing the thing, and work on that. I record the code, which made focus switch from one cell to another, and it looked like this:

    Code:
    Range("F4").Select
    Tyr putting this code under command button, but remember to change the target value, so it fits into your program.

    I'm not sure what you mean by your last question. But here goes. If you have created some code in VBA under EXCEL, you would need to run it by opening EXCEL, there is no need for VB here.

  3. #3
    Fanatic Member InvisibleDuncan's Avatar
    Join Date
    May 2001
    Location
    Eating jam.
    Posts
    819
    If you want to call the Excel spreadsheet from VB you can (by using the Excel object library), but as AIS_DK said, it's not necessary.

    If you want to access the VBA Editor from Excel, it's under the Tools Menu. Tools -> Macro -> Visual Basic Editor.

    If you decide to record one, you can switch between absolute and relative recording. The difference is: in absolute recording, if you move to cell B1, it codes it to move you to cell B1 from wherever you may be. With relative recording, if you move from A1 to B1, it codes it to move one cell to the right. It depends on what you want to achieve with your macro.
    Indecisiveness is the key to flexibility.

    www.mangojacks.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width