Richard in Redditch
New Member
- Joined
- Feb 7, 2012
- Messages
- 44
Hello
I have a small project, which is giving me a large problem, and I have battled with it all afternoon (sigh!). I would be so grateful for some help, please!
The project is to keep track of Clients, and to maintain a summary of amounts invoiced, the type of work done, and so on. The summary sheet has a list of Client names in its A column, and each Client has his/her individual worksheet. I have coded a macro which sets up the client details, both in the summary sheet and in the new Client's worksheet. Not a particularly difficult project so far, but I want to include a hyperlink from the Client name in the summary sheet to the individual's personal worksheet which is given the Client's name. The code I have written is as follows:
' Insert hyperlink to new worksheet, insert new blank row
Sheets("Summary").Activate
Cells(NewSumryRow, 1).Select
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:= _
Sheets(ClientName).ClientName & "!A1", TextToDisplay:=ClientName
Rows("newsumryrow:newsumryrow").Select
Selection.Insert Shift:=xlDown
Unload UserForm1
MsgBox "Client '" & ClientName & "' now set up"
When I run the macro it falls over at the bold section above with "runtime error 438 - Object doesn't support this property or method". I have tried putting single and double quote marks around ClientName (which is a string variable), and using one and two words for the client's name, but nothing seems to affect matters. When I insert the HL manually, there is no trouble at all - but I would like to have it automated!
I have a small project, which is giving me a large problem, and I have battled with it all afternoon (sigh!). I would be so grateful for some help, please!
The project is to keep track of Clients, and to maintain a summary of amounts invoiced, the type of work done, and so on. The summary sheet has a list of Client names in its A column, and each Client has his/her individual worksheet. I have coded a macro which sets up the client details, both in the summary sheet and in the new Client's worksheet. Not a particularly difficult project so far, but I want to include a hyperlink from the Client name in the summary sheet to the individual's personal worksheet which is given the Client's name. The code I have written is as follows:
' Insert hyperlink to new worksheet, insert new blank row
Sheets("Summary").Activate
Cells(NewSumryRow, 1).Select
ActiveSheet.Hyperlinks.Add Anchor:=Selection, Address:="", SubAddress:= _
Sheets(ClientName).ClientName & "!A1", TextToDisplay:=ClientName
Rows("newsumryrow:newsumryrow").Select
Selection.Insert Shift:=xlDown
Unload UserForm1
MsgBox "Client '" & ClientName & "' now set up"
When I run the macro it falls over at the bold section above with "runtime error 438 - Object doesn't support this property or method". I have tried putting single and double quote marks around ClientName (which is a string variable), and using one and two words for the client's name, but nothing seems to affect matters. When I insert the HL manually, there is no trouble at all - but I would like to have it automated!