Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default what's wrong with my code????

Almost ready to pull my hair out over this one...

Why can't I get the following code to assign the linkedcell value of an
activex combobox????? After running this code the linkedcell value
remains blank.

Sheets("Row Template").Activate
ActiveSheet.ComboBox1.LinkedCell = Range("Offset(insertpoint, -6, 1)")

Yet if I change the code following the '=' symbol to a direct reference
(as below) it works:

Sheets("Row Template").Activate
ActiveSheet.ComboBox1.LinkedCell = "A1"


Am I using the offset method incorrectly???? How do I do this? Please
please help me!


---
Message posted from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default what's wrong with my code????

Cornish,

I haven't tried it, but 3 things look wrong. Offset is a property of the
Range object , not an argument to range, it on ly has 2 arguments (row and
column), and Range must refer to cell(s). Try something like


ActiveSheet.ComboBox1.LinkedCell = Range("G1").Offset(insertpoint, -6)


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"cornishbloke " wrote in
message ...
Almost ready to pull my hair out over this one...

Why can't I get the following code to assign the linkedcell value of an
activex combobox????? After running this code the linkedcell value
remains blank.

Sheets("Row Template").Activate
ActiveSheet.ComboBox1.LinkedCell = Range("Offset(insertpoint, -6, 1)")

Yet if I change the code following the '=' symbol to a direct reference
(as below) it works:

Sheets("Row Template").Activate
ActiveSheet.ComboBox1.LinkedCell = "A1"


Am I using the offset method incorrectly???? How do I do this? Please
please help me!


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default what's wrong with my code????

Thanks Bob,

I tried your suggestion, adapting it as follows, but when i checked th
combobox the value for the linkedcell was blank.

ActiveSheet.ComboBox1.LinkedCell = Range("insertpoint").Offset(-6, 1)

insertpoint is the named range that I'm trying to offset from to ge
the linkedcell reference.

Am I missing something

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default what's wrong with my code????

We were missing something on the command. It should be

ActiveSheet.ComboBox1.LinkedCell = Range("insertpoint").Offset(-6,
1).Address

as the linked cell is not a range, but a range string.

The other thing to be aware of is that as soon as you set the linked cell,
the combobox is updated with is value (empty?), so it may be best to load it
before setting linkedcell

With ActiveSheet.ComboBox1
Range("insertpoint").Offset(-6, 1).Value = .Value
.LinkedCell = Range("insertpoint").Offset(-6, 1).Address
End With


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"cornishbloke " wrote in
message ...
Thanks Bob,

I tried your suggestion, adapting it as follows, but when i checked the
combobox the value for the linkedcell was blank.

ActiveSheet.ComboBox1.LinkedCell = Range("insertpoint").Offset(-6, 1)

insertpoint is the named range that I'm trying to offset from to get
the linkedcell reference.

Am I missing something?


---
Message posted from http://www.ExcelForum.com/



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default what's wrong with my code????

Bob,

Once again I owe you my gratitude, thank you very much for your help -
that answers a problem I've had for days and it works perfectly.


---
Message posted from http://www.ExcelForum.com/



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default what's wrong with my code????

As I say, it's a pleasure to help a fellow south-west man.

Regards

Bob

"cornishbloke " wrote in
message ...
Bob,

Once again I owe you my gratitude, thank you very much for your help -
that answers a problem I've had for days and it works perfectly.


---
Message posted from http://www.ExcelForum.com/



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
What is wrong with this code? jlclyde Excel Discussion (Misc queries) 5 January 9th 08 05:12 PM
What is wrong with the code? Eric Excel Discussion (Misc queries) 2 September 13th 07 10:36 AM
What's wrong with my code ? christophe meresse Excel Worksheet Functions 3 August 2nd 05 05:09 PM
What's wrong with this bit of code Mervyn Thomas Excel Programming 7 January 22nd 04 03:56 PM
Is something wrong with the code Patrick Molloy[_3_] Excel Programming 1 July 15th 03 08:28 AM


All times are GMT +1. The time now is 03:14 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"