Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default CHECK BOX HELP NEEDED

CHECK BOX HELP PLEASE.

My sheet contains 80 rows. (80 competitors). Their results are posted, one
row to a competitor. Starting on row 7 - 87

I have a check box (default €“ unchecked) in cell K7. Its purpose is to
indicate, whether the competitors times qualify for the event, There are
three timers. The three times are averaged to give €śThe Time€ť. If they run
over their time, this checkbox should be clicked and the previously entered
times in C7,E7,E8 should be replaced with NIL.
This check box will be in Col k on every row.
I can record a macro to do this on that line, but I want to use a relative
function so that I can copy it down the page to make give the same code to
every row, instead of having 80 macros. I have nearly been there but
everytime I get close, I seem to come up with something not quite right. Any
help very much appreciated.

  #2   Report Post  
Posted to microsoft.public.excel.programming
Ian Ian is offline
external usenet poster
 
Posts: 238
Default CHECK BOX HELP NEEDED

Post the macro code you recorded and let folks have a look at it.

--
Ian
--
"SYBS" wrote in message
...
CHECK BOX HELP PLEASE.

My sheet contains 80 rows. (80 competitors). Their results are posted,
one
row to a competitor. Starting on row 7 - 87

I have a check box (default - unchecked) in cell K7. Its purpose is to
indicate, whether the competitors times qualify for the event, There are
three timers. The three times are averaged to give "The Time". If they
run
over their time, this checkbox should be clicked and the previously
entered
times in C7,E7,E8 should be replaced with NIL.
This check box will be in Col k on every row.
I can record a macro to do this on that line, but I want to use a relative
function so that I can copy it down the page to make give the same code to
every row, instead of having 80 macros. I have nearly been there but
everytime I get close, I seem to come up with something not quite right.
Any
help very much appreciated.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 158
Default CHECK BOX HELP NEEDED

I replied to your previous post of this (see below):

Note further, if you wish to use the same code for each checkbox you
could do something like this (working out which row the checkbox is on
from its linked cell):

Private Sub CheckBox1_Click()
WriteNilInRow CheckBox1.LinkedCell.Row
End Sub

Sub WriteNilInRow(lRow as long)
WIth activesheet.
.Cells(lRow, 3) = "NIL"
.Cells(lRow, 5) = "NIL"
.Cells(lRow, 6) = "NIL"
End With
End Sub

But you still need to have an event for each checkbox. Which is why I
suggested using single buttons at the top of the form in my earlier
response.

'----Previous reponse ----------
If you posted your code so far it might be easier to correct it.

Without seeing it, maybe this will point you in the right direction,
although it doesn't work from checkboxes, rather I would suggest placing
a button on your worksheet (use freeze panes to prevent it scrolling off
the visible window).

Sub WriteNilInSelectedRows()
Dim r as range
With Selection.Parent
For Each r In Selection.Rows
.Cells(r.Row, 3) = "NIL"
.Cells(r.Row, 5) = "NIL"
.Cells(r.Row, 6) = "NIL"
Next r
End With
End Sub

Sub WriteNilInAllRows()
With ThisWorkbook.ActiveSheet
Range(.Cells(7, 3), .Cells(87, 3)) = "NIL"
Range(.Cells(7, 5), .Cells(87, 6)) = "NIL"
End With
End sub

HTH,
G


SYBS wrote:
CHECK BOX HELP PLEASE.

My sheet contains 80 rows. (80 competitors). Their results are posted, one
row to a competitor. Starting on row 7 - 87

I have a check box (default €“ unchecked) in cell K7. Its purpose is to
indicate, whether the competitors times qualify for the event, There are
three timers. The three times are averaged to give €śThe Time€ť. If they run
over their time, this checkbox should be clicked and the previously entered
times in C7,E7,E8 should be replaced with NIL.
This check box will be in Col k on every row.
I can record a macro to do this on that line, but I want to use a relative
function so that I can copy it down the page to make give the same code to
every row, instead of having 80 macros. I have nearly been there but
everytime I get close, I seem to come up with something not quite right. Any
help very much appreciated.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 31
Default CHECK BOX HELP NEEDED

Sorry not to have seen reply, couldn;t even find post when I looked this
morning and assumed I had sent it to the wrong area. Anyway thanks for both
responses and from Ian also. I looked at someone elses answer to a query
and thought I probably needed to link a cell to the checkbox and then use the
link cell in the formula. I tried it out and it does work but it's meaning
all the checkboxes (80 of them) have to be individually linked I think
because I have tried to take the simple way as I am a beginner and am a bit
scared of VB etc. I am working on it !

"Gareth" wrote:

I replied to your previous post of this (see below):

Note further, if you wish to use the same code for each checkbox you
could do something like this (working out which row the checkbox is on
from its linked cell):

Private Sub CheckBox1_Click()
WriteNilInRow CheckBox1.LinkedCell.Row
End Sub

Sub WriteNilInRow(lRow as long)
WIth activesheet.
.Cells(lRow, 3) = "NIL"
.Cells(lRow, 5) = "NIL"
.Cells(lRow, 6) = "NIL"
End With
End Sub

But you still need to have an event for each checkbox. Which is why I
suggested using single buttons at the top of the form in my earlier
response.

'----Previous reponse ----------
If you posted your code so far it might be easier to correct it.

Without seeing it, maybe this will point you in the right direction,
although it doesn't work from checkboxes, rather I would suggest placing
a button on your worksheet (use freeze panes to prevent it scrolling off
the visible window).

Sub WriteNilInSelectedRows()
Dim r as range
With Selection.Parent
For Each r In Selection.Rows
.Cells(r.Row, 3) = "NIL"
.Cells(r.Row, 5) = "NIL"
.Cells(r.Row, 6) = "NIL"
Next r
End With
End Sub

Sub WriteNilInAllRows()
With ThisWorkbook.ActiveSheet
Range(.Cells(7, 3), .Cells(87, 3)) = "NIL"
Range(.Cells(7, 5), .Cells(87, 6)) = "NIL"
End With
End sub

HTH,
G


SYBS wrote:
CHECK BOX HELP PLEASE.

My sheet contains 80 rows. (80 competitors). Their results are posted, one
row to a competitor. Starting on row 7 - 87

I have a check box (default €“ unchecked) in cell K7. Its purpose is to
indicate, whether the competitors times qualify for the event, There are
three timers. The three times are averaged to give €śThe Time€ť. If they run
over their time, this checkbox should be clicked and the previously entered
times in C7,E7,E8 should be replaced with NIL.
This check box will be in Col k on every row.
I can record a macro to do this on that line, but I want to use a relative
function so that I can copy it down the page to make give the same code to
every row, instead of having 80 macros. I have nearly been there but
everytime I get close, I seem to come up with something not quite right. Any
help very much appreciated.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 158
Default CHECK BOX HELP NEEDED

No problem - good luck!

SYBS wrote:
Sorry not to have seen reply, couldn;t even find post when I looked this
morning and assumed I had sent it to the wrong area. Anyway thanks for both
responses and from Ian also. I looked at someone elses answer to a query
and thought I probably needed to link a cell to the checkbox and then use the
link cell in the formula. I tried it out and it does work but it's meaning
all the checkboxes (80 of them) have to be individually linked I think
because I have tried to take the simple way as I am a beginner and am a bit
scared of VB etc. I am working on it !

"Gareth" wrote:


I replied to your previous post of this (see below):

Note further, if you wish to use the same code for each checkbox you
could do something like this (working out which row the checkbox is on
from its linked cell):

Private Sub CheckBox1_Click()
WriteNilInRow CheckBox1.LinkedCell.Row
End Sub

Sub WriteNilInRow(lRow as long)
WIth activesheet.
.Cells(lRow, 3) = "NIL"
.Cells(lRow, 5) = "NIL"
.Cells(lRow, 6) = "NIL"
End With
End Sub

But you still need to have an event for each checkbox. Which is why I
suggested using single buttons at the top of the form in my earlier
response.

'----Previous reponse ----------
If you posted your code so far it might be easier to correct it.

Without seeing it, maybe this will point you in the right direction,
although it doesn't work from checkboxes, rather I would suggest placing
a button on your worksheet (use freeze panes to prevent it scrolling off
the visible window).

Sub WriteNilInSelectedRows()
Dim r as range
With Selection.Parent
For Each r In Selection.Rows
.Cells(r.Row, 3) = "NIL"
.Cells(r.Row, 5) = "NIL"
.Cells(r.Row, 6) = "NIL"
Next r
End With
End Sub

Sub WriteNilInAllRows()
With ThisWorkbook.ActiveSheet
Range(.Cells(7, 3), .Cells(87, 3)) = "NIL"
Range(.Cells(7, 5), .Cells(87, 6)) = "NIL"
End With
End sub

HTH,
G


SYBS wrote:

CHECK BOX HELP PLEASE.

My sheet contains 80 rows. (80 competitors). Their results are posted, one
row to a competitor. Starting on row 7 - 87

I have a check box (default €“ unchecked) in cell K7. Its purpose is to
indicate, whether the competitors times qualify for the event, There are
three timers. The three times are averaged to give €śThe Time€ť. If they run
over their time, this checkbox should be clicked and the previously entered
times in C7,E7,E8 should be replaced with NIL.
This check box will be in Col k on every row.
I can record a macro to do this on that line, but I want to use a relative
function so that I can copy it down the page to make give the same code to
every row, instead of having 80 macros. I have nearly been there but
everytime I get close, I seem to come up with something not quite right. Any
help very much appreciated.


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 box hero needed please. Kev Excel Discussion (Misc queries) 3 June 7th 07 02:44 PM
formula needed to sum check marks veena Excel Worksheet Functions 1 February 24th 07 01:52 AM
formula needed to sum check marks john Excel Worksheet Functions 0 February 22nd 07 09:58 PM
formula needed to sum check marks veena Excel Worksheet Functions 0 February 22nd 07 09:57 PM
CHECK BOX HELP NEEDED PLEASE SYBS Excel Programming 1 September 7th 05 06:53 PM


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

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

About Us

"It's about Microsoft Excel"