Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Check and uncheck a checkbox


I used to be decent at VB, but it's been so many years now, and I can't
remember a lick of this stuff. I'm just trying to create a basic macro
that will do the following:

Start at cell A1 and the auto increment across the row until X
Check the Cell value for data
If there is data then I need it to physically check a checkbox (say
checkbox1)

Thank you in advance for anyone kind enough to lend an old timer a
hand, it's appreciated!

John


--
NoProgram
------------------------------------------------------------------------
NoProgram's Profile: http://www.excelforum.com/member.php...o&userid=33832
View this thread: http://www.excelforum.com/showthread...hreadid=536091

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default Check and uncheck a checkbox

John,

When you say 'auto increment across the row' are you actually putting
incremental numbers into the cells or are are you checking the value of
every cell or are you only interested in the value in X?

Is the checkbox in a userform or on the sheet?

A little more detail about what your trying to do, and maybe why, would
be useful.

Kind regards,
NickH

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Check and uncheck a checkbox


NickH Wrote:
John,

When you say 'auto increment across the row' are you actually putting
incremental numbers into the cells or are are you checking the value
of
every cell or are you only interested in the value in X?

Is the checkbox in a userform or on the sheet?

A little more detail about what your trying to do, and maybe why,
would
be useful.

Kind regards,
NickH


Hi Nick,

I want to check to see if there is data in the cell, if there is, then
it will tick off (or check) a checkbox, then increment the cell (if it
was on A1, then advance the B1), and repeat the process again.

And this is in a usersheet. I'm a teacher and I'm taking a web based
test that was created in a form and importing the comma dileminated
data into the excel spreedsheet, and then creating a macro that will
check the values and mark off the answers that were given.

Does that make it more clear? Thanks for your help.


--
NoProgram
------------------------------------------------------------------------
NoProgram's Profile: http://www.excelforum.com/member.php...o&userid=33832
View this thread: http://www.excelforum.com/showthread...hreadid=536091

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default Check and uncheck a checkbox

John,

This placed in a new module should give you a start. I've made certain
assumptions which I'll go through beneath the code...


Sub CheckValues() 'pun intended ;^)
Dim i As Integer

For i = 1 To 4 'i.e. will look at first 4 columns A, B, C & D
If Not Cells(1, i) = "" Then
Sheet1.OLEObjects("CheckBox" & i).Object.Value = 1
Else
Sheet1.OLEObjects("CheckBox" & i).Object.Value = 0
End If
Next i
End Sub

Assumptions:
The codename (not the tab name) of the sheet you are using is Sheet1
The answers you are checking are on row 1 starting at column 1
Each answer has an associated Checkbox, also on Sheet1, called
CheckBox1, CheckBox2 etc.
You are only checking that a value is present, not what it actually is

HTH
NickH

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
check and uncheck macro [email protected] Excel Worksheet Functions 6 April 5th 23 01:19 PM
check or uncheck a check box based on a cell value RTKCPA Excel Discussion (Misc queries) 1 February 3rd 10 03:11 PM
How to have Checkbox A uncheck with checked Checkbox B Texas Aggie Excel Discussion (Misc queries) 3 July 20th 07 10:58 PM
How do I check/uncheck ten or odd Checkboxes by click on one check Ken Vo Excel Discussion (Misc queries) 5 January 4th 06 11:10 PM
Check / Uncheck Box Navy Chief Setting up and Configuration of Excel 1 October 3rd 05 01:54 AM


All times are GMT +1. The time now is 06:38 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"