View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Offset from new name based on what's checked in Userform

Dim rng as Range
set rng = Cells(4,1).End(xldown).Offset(1,0)
rng.Value = new_member
if cbMON then
With rng.offset(0,1)
.Value = iif(cbGH,"u","l")
.Font.Name = "Wingdings"
End With
end if
if cbTUE then
With rng.offset(0,2)
.Value = iif(cbGH,"u","l")
.Font.Name = "Wingdings"
End With
end if
if cbWED then
With rng.offset(0,3)
.Value = iif(cbGH,"u","l")
.Font.Name = "Wingdings"
End With
end if
if cbTHU then
With rng.offset(0,4)
.Value = iif(cbGH,"u","l")
.Font.Name = "Wingdings"
End With
end if
if cbFRI then
With rng.offset(0,5)
.Value = iif(cbGH,"u","l")
.Font.Name = "Wingdings"
End With
end if

--
Regards,
Tom Ogilvy


"David" wrote in message
...
XL2000

I have a sheet that uses a userform to add new names to a list in colA
Early in my code, New_Member is set from userform textbox:
New_Member = UCase$(frmAddMem.tbNewName.Text)

Later my code puts new name at the bottom of current list in ColA:
Set rng = Range(Cells(4, 1), Cells(4, 1).End(xlDown).Offset(1, 0))
rng(rng.Rows.Count) = New_Member

I've added some checkboxes to the userform and renamed them:

cbGH to show name is a group home resident if checked
cbMON to show member attends on Monday if checked
cbTUE to show member attends on Tuesday if checked
and so on through Friday

Cols B:F will house u or l (el) formatted as Wingding to indicate who
attends on a given weekday from a group home or non-group home living
arrangement. I currently enter these manually

Code I want to add:
If cbGH is checked and cbTUE and cbTHU are checked a 'u' will offset from
member name in Cols C and E
If cbGH is unchecked and cbMON, cbWED and cbFRI are checked an 'l' will
offset from member name in Cols B, D, and F

Above are just two scenarios. Any member from any group can attend on any
day, some all 5, some just 1 or any mix thereof.

I want code to look at the state of the checkboxes and act accordingly to
populate B:F with u's or l's or leave any unchecked empty.

I would be willing the change the name property of the boxes to make

things
easier, if required.

--
David