Hi,
Rick Rothstein helped me create a nifty userform to find commented cells. Works great!
However I need to be able to send this to other users and currently it only works on my machine!
Please help me.
The Userform code:
I activate this from this code in workbook:
As soon as i open the file on another machine i get a compile error - "Wrong number of arguments or invalid property assignment"
It doesn't like the .Show
If I try to run the form from the Userform_Initialize Sub I get a runtime error 32809 "Application-defined or object-defined error"
It doesn't like the
I can get the form to open if I change the sub to: Userform2_Initialize() (userform2 being the name of the form)
Now the form is open, if i click on a button i get an error. For example:
If i click the Next button (Cmdcnext), i get a runtime error 91 - "Object variable or with block variable not set"
and it points to
I just want it to work as it does on my machine.....
the destination machine is excel 97 with object 8.0 library
mine is excel 2013 with object 14.0 library
is this why? is there any way around this?
Rick Rothstein helped me create a nifty userform to find commented cells. Works great!
However I need to be able to send this to other users and currently it only works on my machine!
Please help me.
The Userform code:
Code:
Dim CurrentComment As Long, PreviousCell As Range
Private Sub CmdcNext_Click()
PreviousCell.Interior.ColorIndex = xlColorIndexNone
CurrentComment = CurrentComment - (CurrentComment < ActiveSheet.comments.Count)
Set PreviousCell = Range(ActiveSheet.comments(CurrentComment).Parent.Address)
Cellcommentsa = ActiveSheet.comments(CurrentComment).Text
Cellcontentsa = ActiveSheet.comments(CurrentComment).Parent.Value
Cellrefa = Chr(ActiveSheet.comments(CurrentComment).Parent.Column + 64) & ActiveSheet.comments(CurrentComment).Parent.Row
PreviousCell.Select
PreviousCell.Interior.ColorIndex = 46
End Sub
Private Sub CmdcPrev_Click()
PreviousCell.Interior.ColorIndex = xlColorIndexNone
CurrentComment = CurrentComment + (CurrentComment > 1)
Set PreviousCell = Range(ActiveSheet.comments(CurrentComment).Parent.Address)
Cellcommentsa = ActiveSheet.comments(CurrentComment).Text
Cellcontentsa = ActiveSheet.comments(CurrentComment).Parent.Value
Cellrefa = Chr(ActiveSheet.comments(CurrentComment).Parent.Column + 64) & ActiveSheet.comments(CurrentComment).Parent.Row
PreviousCell.Select
PreviousCell.Interior.ColorIndex = 46
End Sub
Private Sub CmdcStop_Click()
Unload Me
End Sub
Private Sub Label1_Click()
End Sub
Private Sub UserForm_Initialize()
CurrentComment = 1
With ActiveSheet.comments(1)
Cellcommentsa = .Text
Cellcontentsa = .Parent.Value
Cellrefa = Chr(.Parent.Column + 64) & .Parent.Row
Set PreviousCell = Range(.Parent.Address)
PreviousCell.Select
PreviousCell.Interior.ColorIndex = 46
End With
'With Cellcontentsa
' .AutoSize = False
' .Height = 30
' .Width = 198
' .Caption = ""
' .AutoSize = True
' .Top = Label2.Top + ((Label2.Height - .Height) / 2)
' .Left = Label2.Left + ((Label2.Width - .Width) / 2)
'End With
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
PreviousCell.Interior.ColorIndex = xlColorIndexNone
End Sub
I activate this from this code in workbook:
Code:
Private Sub Workbook_Open()
With UserForm2
'.Top = Application.Height / 2 - (UserForm1.Height / 2)
'.Left = Application.Width / 2 - (UserForm1.Width / 2)
.Top = Application.Top '+ 25
.Left = Application.Left '+ Application.Width - UserForm1.Width - 25
.Show vbModeless
End With
End Sub
As soon as i open the file on another machine i get a compile error - "Wrong number of arguments or invalid property assignment"
It doesn't like the .Show
If I try to run the form from the Userform_Initialize Sub I get a runtime error 32809 "Application-defined or object-defined error"
It doesn't like the
Code:
With Activesheet.comments(1)
I can get the form to open if I change the sub to: Userform2_Initialize() (userform2 being the name of the form)
Now the form is open, if i click on a button i get an error. For example:
If i click the Next button (Cmdcnext), i get a runtime error 91 - "Object variable or with block variable not set"
and it points to
Code:
PreviousCell.Interior.ColorIndex = xlColorIndexNone
I just want it to work as it does on my machine.....
the destination machine is excel 97 with object 8.0 library
mine is excel 2013 with object 14.0 library
is this why? is there any way around this?