Macro help. Newbie
MZ Tools makes life easier for the Excel VBA coder
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 5 of 5

Thread: Macro help. Newbie

  1. #1
    New Member
    Join Date
    Mar 2002
    Posts
    24
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    HI, I have just started using excel after becominreasonable profficient in Access.

    Eeeeek, there are no do it your self cut and paste macros! Ouch!

    Here is what I need. I need to know how to clear a row in a table from a for in another worksheet. This worksheet contains textboxes and drop down menus which link to tables in other worksheets. I want to put a command button on the main form whcih will clear all the contents of these text boxes and the cells they link to.

    It would be ideal that a refresh - clear contents fromm these rows acts on iniciation of the workbook.

    Also, I would like to open different worksheets from command buttons on the main form.

    Sorry. Am I asking too much? I am just starting out

    Thanks

    Mathew

  2. #2
    MrExcel MVP Barrie Davidson's Avatar
    Join Date
    Feb 2002
    Location
    Winnipeg
    Posts
    2,330
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Here is what I need. I need to know how to clear a row in a table from a for in another worksheet. This worksheet contains textboxes and drop down menus which link to tables in other worksheets. I want to put a command button on the main form whcih will clear all the contents of these text boxes and the cells they link to.
    Something like:
    TextBox1.Text = ""
    will clear the contents of your text box. If the text box is linked to a cell, it should automatically clear out that cell as well. Of course, you could also clear the cell using:
    Range("A1").ClearContents

    It would be ideal that a refresh - clear contents fromm these rows acts on iniciation of the workbook.
    If you mean you want to clear out certain rows each time the workbook is opened, you could put this in the workbook's code:

    Private Sub Workbook_Open()
    Sheets("Sheet1").Rows("2:3").ClearContents
    End Sub

    and change the sheet and row references to your requirements.

    Also, I would like to open different worksheets from command buttons on the main form.
    Attach code to your button that resembles this:

    Private Sub CommandButton1_Click()
    Workbooks.Open FileName:= _
    "C:Book1.xls"
    End Sub


    If you need any further help just let me know.

    Regards,
    Barrie Davidson

    "You're only given a little spark of madness. You mustn't lose it." - Robin Williams

  3. #3
    New Member
    Join Date
    Mar 2002
    Posts
    24
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Also, I would like to open different worksheets from command buttons on the main form.


    --------------------------------------------------------------------------------


    Thank you very much. Everything works apart from:
    the last part

    I want to open different worksheets in the same workbook from command buttons on sheet one - not open workbooks.


    This part Attach code to your button that resembles this:

    Private Sub CommandButton1_Click()
    Workbooks.Open FileName:= _
    "C:Book1.xls"
    End Sub

    PLease help.

    Mathew


  4. #4
    MrExcel MVP Barrie Davidson's Avatar
    Join Date
    Feb 2002
    Location
    Winnipeg
    Posts
    2,330
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-03-09 10:21, Matty2470 wrote:
    Also, I would like to open different worksheets from command buttons on the main form.


    --------------------------------------------------------------------------------


    Thank you very much. Everything works apart from:
    the last part

    I want to open different worksheets in the same workbook from command buttons on sheet one - not open workbooks.


    This part Attach code to your button that resembles this:

    Private Sub CommandButton1_Click()
    Workbooks.Open FileName:= _
    "C:Book1.xls"
    End Sub

    PLease help.

    Mathew

    Mathew, I assume you mean you want to activate different worksheets in the same workbook (you can't open a worksheet). If my assumption is correct, try this:


    Private Sub CommandButton1_Click()
    Sheets("Sheet3").Activate
    End Sub


    This will activate Sheet3.

    Is this what you are looking for?

    Barrie Davidson

    "You're only given a little spark of madness. You mustn't lose it." - Robin Williams

  5. #5
    New Member
    Join Date
    Mar 2002
    Posts
    24
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    Yes, exactly!

    Thank you

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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

 

 
DMCA.com