zoom38
11-17-2009, 06:02 PM
Hello everyone, I am having a problem with the following code:
If mm = 1 Then
With ActiveSheet.Range(Cells(January, 2), Cells(January, 15))
Set cell1 = .Find(dd, LookIn:=xlValues, lookat:=xlPart)
If Not cell1 Is Nothing Then
firstaddress = cell1.Address
Call TestForComments
If q = "No Comment" Then
Range(firstaddress).AddComment ("Training On " & mydate)
Range(firstaddress).Interior.ColorIndex = 6
With Range(firstaddress)
.Characters(InStr(cell1, ddd)).Font.Bold = True
End With
End If
If q = "Has Comment" Then
cmt = Range(firstaddress).Comment.Text
Range(firstaddress).ClearComments
Range(firstaddress).AddComment (cmt & ", Training On " & mydate)
Range(firstaddress).Interior.ColorIndex = 6
With Range(firstaddress)
.Characters(InStr(cell1, ddd)).Font.Bold = True
End With
End If
End If
End With
End If
I have dates in cells as text such as "1,15,29", "12,26" etc. which represent the dates of the month. What I am doing is finding a date adding a comment in the cell and trying to make the specific date within the cell bold. What is happening is if the first date in the cell is that date, all of the dates in the cell will turn bold and if the second date is the selected date, both the second and third date will turn bold. I can't seem to get a handle on the problem. I'm attaching the file if you need it to respond and the code I am dealing with is in Module06 in sub Trainingdates.
Thanks
Gary
If mm = 1 Then
With ActiveSheet.Range(Cells(January, 2), Cells(January, 15))
Set cell1 = .Find(dd, LookIn:=xlValues, lookat:=xlPart)
If Not cell1 Is Nothing Then
firstaddress = cell1.Address
Call TestForComments
If q = "No Comment" Then
Range(firstaddress).AddComment ("Training On " & mydate)
Range(firstaddress).Interior.ColorIndex = 6
With Range(firstaddress)
.Characters(InStr(cell1, ddd)).Font.Bold = True
End With
End If
If q = "Has Comment" Then
cmt = Range(firstaddress).Comment.Text
Range(firstaddress).ClearComments
Range(firstaddress).AddComment (cmt & ", Training On " & mydate)
Range(firstaddress).Interior.ColorIndex = 6
With Range(firstaddress)
.Characters(InStr(cell1, ddd)).Font.Bold = True
End With
End If
End If
End With
End If
I have dates in cells as text such as "1,15,29", "12,26" etc. which represent the dates of the month. What I am doing is finding a date adding a comment in the cell and trying to make the specific date within the cell bold. What is happening is if the first date in the cell is that date, all of the dates in the cell will turn bold and if the second date is the selected date, both the second and third date will turn bold. I can't seem to get a handle on the problem. I'm attaching the file if you need it to respond and the code I am dealing with is in Module06 in sub Trainingdates.
Thanks
Gary