Hi,
I'm very new to this spreadsheet creation and having some trouble.
I've created a spreadsheet (A3-K100) and when I double click on an empty cell I get a pop up form (frmTreatTrack) to assist in completing the spreadsheet. This works fine
I then wanted to auto sort the spreadsheet when new data is entered. So I recorded a marco which sorts the spreadsheet depending on the value in Column J. When I run this macro it works.
So next I thought I would be able to use the code for this macro and copy & paste in to Sheet1 (location of spreadsheet)
Now when I double click I get a Complie Error
"member already exists in an object module from which this object module derives.
Question is what am i doing wrong and how do I solve it. I've added the code below if this helps or is it the way I'm trying to do it?
any help would be appreciated.
(I also have another question which relates to the form I've created. Is it possible to have a pop up Calendar on the date selection if I don't have Calendar Control? - This might need a seperate post but thought I would just ask as I'm here)
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Target = "" Then frmTreatTrack.Show
End Sub
Sub Sort()
'
' Sort Macro
'
'
Range("A3:K100").Select
Range("K3").Activate
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Clear
ActiveWorkbook.Worksheets("Sheet1").Sort.SortFields.Add Key:=Range("J4:J100") _
, SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With ActiveWorkbook.Worksheets("Sheet1").Sort
.SetRange Range("A3:K100")
.Header = xlYes
.MatchCase = False
.Orientation = xlTopToBottom
.SortMethod = xlPinYin
.Apply
End With
End Sub
Bookmarks