+ Reply to Thread
Results 1 to 6 of 6

Please help this teacher out

  1. #1
    Registered User
    Join Date
    04-25-2006
    Posts
    6

    Please help this teacher out

    I already asked this, but perhaps I didn't ask it correctly. I'm a teacher and I have very little programming experience. I'm trying to create a macro in excel that will take data that I will import, check it, and then check off a checkbox if it exists.

    Basically all I need to know is the command line for actually ticking off (or checking the checkbox). Such as : Activesheet.checkbox1. ??

    Also if someone could explain to me how to increment cells in a row, that would be VERY helpful. I need to move from cell A1 to B1 and so on. So I just need an example of how to increment these cell numbers.

    Thanks to anyone who can assist.

  2. #2
    Jim Thomlinson
    Guest

    RE: Please help this teacher out

    Question 1 - Checking of a checkbox depends on what type of a checkbox you
    have. There are two kinds. One is from the Control toolbox and and the other
    is from the forms toolbar. They work differently so we will need to know what
    kind you have. Right click on the check box if you have a "Properties" in the
    list then you have use the Control Toolbox.

    Question 2 - My prefered method is to use a range object to move around a
    sheet something like this...

    dim rng as Range

    Set rng = Range("A1")
    msgbox rng.Address
    set rng = rng.offset(1,0)
    msgbox rng.Address

    Recorded macros use the active cell but that is not nearly as handy as range
    objects. To move the activecell you can use something like

    msgbox activecell.address
    activecell.offset(1,0).select
    msgbox activecell.Address

    --
    HTH...

    Jim Thomlinson


    "NoProgram" wrote:

    >
    > I already asked this, but perhaps I didn't ask it correctly. I'm a
    > teacher and I have very little programming experience. I'm trying to
    > create a macro in excel that will take data that I will import, check
    > it, and then check off a checkbox if it exists.
    >
    > Basically all I need to know is the command line for actually ticking
    > off (or checking the checkbox). Such as : Activesheet.checkbox1. ??
    >
    > Also if someone could explain to me how to increment cells in a row,
    > that would be VERY helpful. I need to move from cell A1 to B1 and so
    > on. So I just need an example of how to increment these cell numbers.
    >
    > Thanks to anyone who can assist.
    >
    >
    > --
    > NoProgram
    > ------------------------------------------------------------------------
    > NoProgram's Profile: http://www.excelforum.com/member.php...o&userid=33832
    > View this thread: http://www.excelforum.com/showthread...hreadid=536170
    >
    >


  3. #3
    Mike Q.
    Guest

    RE: Please help this teacher out

    UserForm1.CheckBox1.Value = True

    ActiveCell.Offset(0, 1).Select
    activecell.offset(rows to move, columns to move), positive numbers go down
    rows or to the right for columns & negative number go up & left.
    --
    Mike Q.


    "NoProgram" wrote:

    >
    > I already asked this, but perhaps I didn't ask it correctly. I'm a
    > teacher and I have very little programming experience. I'm trying to
    > create a macro in excel that will take data that I will import, check
    > it, and then check off a checkbox if it exists.
    >
    > Basically all I need to know is the command line for actually ticking
    > off (or checking the checkbox). Such as : Activesheet.checkbox1. ??
    >
    > Also if someone could explain to me how to increment cells in a row,
    > that would be VERY helpful. I need to move from cell A1 to B1 and so
    > on. So I just need an example of how to increment these cell numbers.
    >
    > Thanks to anyone who can assist.
    >
    >
    > --
    > NoProgram
    > ------------------------------------------------------------------------
    > NoProgram's Profile: http://www.excelforum.com/member.php...o&userid=33832
    > View this thread: http://www.excelforum.com/showthread...hreadid=536170
    >
    >


  4. #4
    Registered User
    Join Date
    04-25-2006
    Posts
    6
    Quote Originally Posted by Jim Thomlinson
    Question 1 - Checking of a checkbox depends on what type of a checkbox you
    have. There are two kinds. One is from the Control toolbox and and the other
    is from the forms toolbar. They work differently so we will need to know what
    kind you have. Right click on the check box if you have a "Properties" in the
    list then you have use the Control Toolbox.

    Question 2 - My prefered method is to use a range object to move around a
    sheet something like this...

    dim rng as Range

    Set rng = Range("A1")
    msgbox rng.Address
    set rng = rng.offset(1,0)
    msgbox rng.Address

    Recorded macros use the active cell but that is not nearly as handy as range
    objects. To move the activecell you can use something like

    msgbox activecell.address
    activecell.offset(1,0).select
    msgbox activecell.Address

    --
    HTH...

    Jim Thomlinson


    "NoProgram" wrote:

    >
    > I already asked this, but perhaps I didn't ask it correctly. I'm a
    > teacher and I have very little programming experience. I'm trying to
    > create a macro in excel that will take data that I will import, check
    > it, and then check off a checkbox if it exists.
    >
    > Basically all I need to know is the command line for actually ticking
    > off (or checking the checkbox). Such as : Activesheet.checkbox1. ??
    >
    > Also if someone could explain to me how to increment cells in a row,
    > that would be VERY helpful. I need to move from cell A1 to B1 and so
    > on. So I just need an example of how to increment these cell numbers.
    >
    > Thanks to anyone who can assist.
    >
    >
    > --
    > NoProgram
    > ------------------------------------------------------------------------
    > NoProgram's Profile: http://www.excelforum.com/member.php...o&userid=33832
    > View this thread: http://www.excelforum.com/showthread...hreadid=536170
    >
    >
    Hi Jim,

    Thanks for your help. Someone else responded with the answer for the checkbox, but it was from the control toolbox.

    Much appreciated!

  5. #5
    Registered User
    Join Date
    04-25-2006
    Posts
    6
    Hi Mike,

    Thanks very much! That did the trick. I knew it was something simple like that, but have you ever seen a teacher under a time restraint pulling his har out trying to figure this out... it's not pretty.

    Thanks again.

    Quote Originally Posted by Mike Q.
    UserForm1.CheckBox1.Value = True

    ActiveCell.Offset(0, 1).Select
    activecell.offset(rows to move, columns to move), positive numbers go down
    rows or to the right for columns & negative number go up & left.
    --
    Mike Q.


    "NoProgram" wrote:

    >
    > I already asked this, but perhaps I didn't ask it correctly. I'm a
    > teacher and I have very little programming experience. I'm trying to
    > create a macro in excel that will take data that I will import, check
    > it, and then check off a checkbox if it exists.
    >
    > Basically all I need to know is the command line for actually ticking
    > off (or checking the checkbox). Such as : Activesheet.checkbox1. ??
    >
    > Also if someone could explain to me how to increment cells in a row,
    > that would be VERY helpful. I need to move from cell A1 to B1 and so
    > on. So I just need an example of how to increment these cell numbers.
    >
    > Thanks to anyone who can assist.
    >
    >
    > --
    > NoProgram
    > ------------------------------------------------------------------------
    > NoProgram's Profile: http://www.excelforum.com/member.php...o&userid=33832
    > View this thread: http://www.excelforum.com/showthread...hreadid=536170
    >
    >

  6. #6
    Vic Eldridge
    Guest

    RE: Please help this teacher out

    > Also if someone could explain to me how to increment cells in a row,
    > that would be VERY helpful. I need to move from cell A1 to B1 and so
    > on.


    There are many ways to acheive this. Here are some examples of commonly
    used techniques. The last example (although the easiest for a newby to
    visualise) is the least desirable, as the Select method is very slow and
    often leads to unwanted side effects.

    Regards,
    Vic Eldridge

    '-----------------------------------------------------------
    Dim cel As Range
    For Each cel In ActiveSheet.Rows(1).Cells
    MsgBox cel.Address
    Next cel
    '-----------------------------------------------------------
    Dim cel As Range
    For Each cel In ActiveSheet.Range("A1:IV1")
    MsgBox cel.Address
    Next cel
    '-----------------------------------------------------------
    Dim Col As Range
    For Each Col In ActiveSheet.Columns
    MsgBox Col.Cells(1).Address
    Next Col
    '-----------------------------------------------------------
    Dim i As Integer
    For i = 0 To 255
    MsgBox ActiveSheet.Range("A1").Offset(0, i).Address
    Next i
    '-----------------------------------------------------------
    Dim i As Integer
    For i = 1 To 256
    MsgBox ActiveSheet.Cells(1, i).Address
    Next i
    '-----------------------------------------------------------
    Range("A1").Select
    Do
    MsgBox ActiveCell.Address
    If ActiveCell.Column = 256 Then Exit Do
    ActiveCell.Offset(0, 1).Select
    Loop
    '-----------------------------------------------------------

    "NoProgram" wrote:

    >
    > I already asked this, but perhaps I didn't ask it correctly. I'm a
    > teacher and I have very little programming experience. I'm trying to
    > create a macro in excel that will take data that I will import, check
    > it, and then check off a checkbox if it exists.
    >
    > Basically all I need to know is the command line for actually ticking
    > off (or checking the checkbox). Such as : Activesheet.checkbox1. ??
    >
    > Also if someone could explain to me how to increment cells in a row,
    > that would be VERY helpful. I need to move from cell A1 to B1 and so
    > on. So I just need an example of how to increment these cell numbers.
    >
    > Thanks to anyone who can assist.
    >
    >
    > --
    > NoProgram
    > ------------------------------------------------------------------------
    > NoProgram's Profile: http://www.excelforum.com/member.php...o&userid=33832
    > View this thread: http://www.excelforum.com/showthread...hreadid=536170
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1