Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi -
I have a little vb code that is creating comments within a cell to keep track of when the cell is changed. I copied the code from another one of my worksheets and it works fine, but on this new worksheet it is erroring out. Help. Here is the code: Dim StrS strS = ActiveCell.Comment.Text ActiveCell.ClearComments ActiveCell.AddComment Text:=strS & "ACCEPTED: " & Date The code in the original worksheet with written in Excel 2003, I am now using Excel 2007....I don't think that has anything to do with it since the old worksheet works fine in Excel 2007. Any help would be great, thanks! Mike |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
What is the error message and what line of code triggers it?
"Mike R." wrote: Hi - I have a little vb code that is creating comments within a cell to keep track of when the cell is changed. I copied the code from another one of my worksheets and it works fine, but on this new worksheet it is erroring out. Help. Here is the code: Dim StrS strS = ActiveCell.Comment.Text ActiveCell.ClearComments ActiveCell.AddComment Text:=strS & "ACCEPTED: " & Date The code in the original worksheet with written in Excel 2003, I am now using Excel 2007....I don't think that has anything to do with it since the old worksheet works fine in Excel 2007. Any help would be great, thanks! Mike |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
If the cell doesn't have a comment, you'll get that error.
Maybe you want something like: Dim StrS As String If ActiveCell.Comment Is Nothing Then StrS = "" Else StrS = ActiveCell.Comment.Text ActiveCell.ClearComments End If ActiveCell.AddComment Text:=StrS & "ACCEPTED: " & Date Mike R. wrote: Hi - I have a little vb code that is creating comments within a cell to keep track of when the cell is changed. I copied the code from another one of my worksheets and it works fine, but on this new worksheet it is erroring out. Help. Here is the code: Dim StrS strS = ActiveCell.Comment.Text ActiveCell.ClearComments ActiveCell.AddComment Text:=strS & "ACCEPTED: " & Date The code in the original worksheet with written in Excel 2003, I am now using Excel 2007....I don't think that has anything to do with it since the old worksheet works fine in Excel 2007. Any help would be great, thanks! Mike -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Runtime Error '91' Object variable or With block variable not set | Excel Discussion (Misc queries) | |||
Runtime Error 91 Object variable or With block variable not set. | Excel Programming | |||
Run-Time error '91': Object variable of With block variable not set | Excel Programming | |||
Run-time error '91': "Object variable or With block variable not set | Excel Programming | |||
Cells.Find error Object variable or With block variable not set | Excel Programming |