Hi, can anyone help out here. I am developing some code to automate a spreadsheet and 2 bits just won't work..
1. a simple sort routine.. (1st I need to find the last used cell)
NewName = Application.InputBox("Enter the Student's Whole name"
With Worksheets("students".Range("a:a"
Set c = .Find("" , LookIn:=xlValues, lookat:=xlWhole)
Address = Right(c.Address, Len(c.Address) - 3)
.Range("B" & Address).Value = Address
.Range("A" & Address).Value = NewName
.Range("A1:B" & Address).Sort key1:=Worksheets("students".Range("A1"
End With
This returns "Runtime Err '1004' - Unable to get the find property of the range class" at the Set c = .... line. Sometimes, if I step the code it goes thru, but then stops at the sort line with same err.
and 2...
Worksheets("Main".Range("a1:az20".Font.ColorIndex = 1
gives "Unable to set the colorindex property of the font class"
BUT... in the same sheet, this bit does work...
Sub Worksheet_change(ByVal Target As Range)
......
Target.Font.ColorIndex = 3
I've tried re-creating the sheet in case there is some underlying error but it's the same.. please can someone help?
Thanks
Georg
1. a simple sort routine.. (1st I need to find the last used cell)
NewName = Application.InputBox("Enter the Student's Whole name"
With Worksheets("students".Range("a:a"
Set c = .Find("" , LookIn:=xlValues, lookat:=xlWhole)
Address = Right(c.Address, Len(c.Address) - 3)
.Range("B" & Address).Value = Address
.Range("A" & Address).Value = NewName
.Range("A1:B" & Address).Sort key1:=Worksheets("students".Range("A1"
End With
This returns "Runtime Err '1004' - Unable to get the find property of the range class" at the Set c = .... line. Sometimes, if I step the code it goes thru, but then stops at the sort line with same err.
and 2...
Worksheets("Main".Range("a1:az20".Font.ColorIndex = 1
gives "Unable to set the colorindex property of the font class"
BUT... in the same sheet, this bit does work...
Sub Worksheet_change(ByVal Target As Range)
......
Target.Font.ColorIndex = 3
I've tried re-creating the sheet in case there is some underlying error but it's the same.. please can someone help?
Thanks
Georg