PC Review


Reply
Thread Tools Rate Thread

ComboBox generic reference

 
 
Brett
Guest
Posts: n/a
 
      9th Jun 2009
I have a series of comboboxes in a sheet (REFI1, REFI23 etc). How can I make
the second line of code generic (i.e pass the value of rw into Me.REFI & rw)?
Dim rw As Long: rw = 51
Range("AG" & rw) = Me.REFI51

I tried:
Range("AG" & rw) = Me.REFI & rw
but it debugs with "REFI" data member not found.
Thanks in advance, Brett.
 
Reply With Quote
 
 
 
 
Jacob Skaria
Guest
Posts: n/a
 
      9th Jun 2009
If you have your combo box in your Activesheet..

Dim rw As Long: rw = 51
'To assign the value from cell to combo
ActiveSheet.REFI51 = Range("AG" & rw)

'To assign the value from combo to cell
Range("AG" & rw) = ActiveSheet.REFI51



--
If this post helps click Yes
---------------
Jacob Skaria


"Brett" wrote:

> I have a series of comboboxes in a sheet (REFI1, REFI23 etc). How can I make
> the second line of code generic (i.e pass the value of rw into Me.REFI & rw)?
> Dim rw As Long: rw = 51
> Range("AG" & rw) = Me.REFI51
>
> I tried:
> Range("AG" & rw) = Me.REFI & rw
> but it debugs with "REFI" data member not found.
> Thanks in advance, Brett.

 
Reply With Quote
 
Brett
Guest
Posts: n/a
 
      9th Jun 2009
Hi Jacob, I think you may have missed my point. The procedure is a generic
one that is called by each of the comboboxes REFI1 through REFI100, so I want
to refer to REFI & rw, where rw is the value passed into the procedure.
Regards, Brett

"Jacob Skaria" wrote:

> If you have your combo box in your Activesheet..
>
> Dim rw As Long: rw = 51
> 'To assign the value from cell to combo
> ActiveSheet.REFI51 = Range("AG" & rw)
>
> 'To assign the value from combo to cell
> Range("AG" & rw) = ActiveSheet.REFI51
>
>
>
> --
> If this post helps click Yes
> ---------------
> Jacob Skaria
>
>
> "Brett" wrote:
>
> > I have a series of comboboxes in a sheet (REFI1, REFI23 etc). How can I make
> > the second line of code generic (i.e pass the value of rw into Me.REFI & rw)?
> > Dim rw As Long: rw = 51
> > Range("AG" & rw) = Me.REFI51
> >
> > I tried:
> > Range("AG" & rw) = Me.REFI & rw
> > but it debugs with "REFI" data member not found.
> > Thanks in advance, Brett.

 
Reply With Quote
 
Jacob Skaria
Guest
Posts: n/a
 
      9th Jun 2009
I missed your point

Dim rw As Long: rw = 51
Range("AG" & rw) = Me.Controls("REFI" & rw)

(this might be a multiple post as i got an error .)
--
If this post helps click Yes
---------------
Jacob Skaria


"Brett" wrote:

> Hi Jacob, I think you may have missed my point. The procedure is a generic
> one that is called by each of the comboboxes REFI1 through REFI100, so I want
> to refer to REFI & rw, where rw is the value passed into the procedure.
> Regards, Brett
>
> "Jacob Skaria" wrote:
>
> > If you have your combo box in your Activesheet..
> >
> > Dim rw As Long: rw = 51
> > 'To assign the value from cell to combo
> > ActiveSheet.REFI51 = Range("AG" & rw)
> >
> > 'To assign the value from combo to cell
> > Range("AG" & rw) = ActiveSheet.REFI51
> >
> >
> >
> > --
> > If this post helps click Yes
> > ---------------
> > Jacob Skaria
> >
> >
> > "Brett" wrote:
> >
> > > I have a series of comboboxes in a sheet (REFI1, REFI23 etc). How can I make
> > > the second line of code generic (i.e pass the value of rw into Me.REFI & rw)?
> > > Dim rw As Long: rw = 51
> > > Range("AG" & rw) = Me.REFI51
> > >
> > > I tried:
> > > Range("AG" & rw) = Me.REFI & rw
> > > but it debugs with "REFI" data member not found.
> > > Thanks in advance, Brett.

 
Reply With Quote
 
Brett
Guest
Posts: n/a
 
      9th Jun 2009
That goes to debug with "Controls data member not found" (it's in a sheet,
not a userform)
Range("AG" & rw) = Me.Controls("REFI" & rw)
The generic procedure is a sub (not a private sub) in a worksheet module.

"Jacob Skaria" wrote:

> I missed your point
>
> Dim rw As Long: rw = 51
> Range("AG" & rw) = Me.Controls("REFI" & rw)
>
> (this might be a multiple post as i got an error .)
> --
> If this post helps click Yes
> ---------------
> Jacob Skaria
>
>
> "Brett" wrote:
>
> > Hi Jacob, I think you may have missed my point. The procedure is a generic
> > one that is called by each of the comboboxes REFI1 through REFI100, so I want
> > to refer to REFI & rw, where rw is the value passed into the procedure.
> > Regards, Brett
> >
> > "Jacob Skaria" wrote:
> >
> > > If you have your combo box in your Activesheet..
> > >
> > > Dim rw As Long: rw = 51
> > > 'To assign the value from cell to combo
> > > ActiveSheet.REFI51 = Range("AG" & rw)
> > >
> > > 'To assign the value from combo to cell
> > > Range("AG" & rw) = ActiveSheet.REFI51
> > >
> > >
> > >
> > > --
> > > If this post helps click Yes
> > > ---------------
> > > Jacob Skaria
> > >
> > >
> > > "Brett" wrote:
> > >
> > > > I have a series of comboboxes in a sheet (REFI1, REFI23 etc). How can I make
> > > > the second line of code generic (i.e pass the value of rw into Me.REFI & rw)?
> > > > Dim rw As Long: rw = 51
> > > > Range("AG" & rw) = Me.REFI51
> > > >
> > > > I tried:
> > > > Range("AG" & rw) = Me.REFI & rw
> > > > but it debugs with "REFI" data member not found.
> > > > Thanks in advance, Brett.

 
Reply With Quote
 
Jacob Skaria
Guest
Posts: n/a
 
      9th Jun 2009
Refer that as

Activesheet.shapes("REFI" & rw)

OR

Sheets("Sheename").shapes("REFI" & rw)


If this post helps click Yes
---------------
Jacob Skaria


"Brett" wrote:

> That goes to debug with "Controls data member not found" (it's in a sheet,
> not a userform)
> Range("AG" & rw) = Me.Controls("REFI" & rw)
> The generic procedure is a sub (not a private sub) in a worksheet module.
>
> "Jacob Skaria" wrote:
>
> > I missed your point
> >
> > Dim rw As Long: rw = 51
> > Range("AG" & rw) = Me.Controls("REFI" & rw)
> >
> > (this might be a multiple post as i got an error .)
> > --
> > If this post helps click Yes
> > ---------------
> > Jacob Skaria
> >
> >
> > "Brett" wrote:
> >
> > > Hi Jacob, I think you may have missed my point. The procedure is a generic
> > > one that is called by each of the comboboxes REFI1 through REFI100, so I want
> > > to refer to REFI & rw, where rw is the value passed into the procedure.
> > > Regards, Brett
> > >
> > > "Jacob Skaria" wrote:
> > >
> > > > If you have your combo box in your Activesheet..
> > > >
> > > > Dim rw As Long: rw = 51
> > > > 'To assign the value from cell to combo
> > > > ActiveSheet.REFI51 = Range("AG" & rw)
> > > >
> > > > 'To assign the value from combo to cell
> > > > Range("AG" & rw) = ActiveSheet.REFI51
> > > >
> > > >
> > > >
> > > > --
> > > > If this post helps click Yes
> > > > ---------------
> > > > Jacob Skaria
> > > >
> > > >
> > > > "Brett" wrote:
> > > >
> > > > > I have a series of comboboxes in a sheet (REFI1, REFI23 etc). How can I make
> > > > > the second line of code generic (i.e pass the value of rw into Me.REFI & rw)?
> > > > > Dim rw As Long: rw = 51
> > > > > Range("AG" & rw) = Me.REFI51
> > > > >
> > > > > I tried:
> > > > > Range("AG" & rw) = Me.REFI & rw
> > > > > but it debugs with "REFI" data member not found.
> > > > > Thanks in advance, Brett.

 
Reply With Quote
 
Brett
Guest
Posts: n/a
 
      9th Jun 2009
Range("AG" & rw) = Sheets("LOANS").Shapes("REFI" & rw)
gives application defined or object defined error

"Jacob Skaria" wrote:

> Refer that as
>
> Activesheet.shapes("REFI" & rw)
>
> OR
>
> Sheets("Sheename").shapes("REFI" & rw)
>
>
> If this post helps click Yes
> ---------------
> Jacob Skaria
>
>
> "Brett" wrote:
>
> > That goes to debug with "Controls data member not found" (it's in a sheet,
> > not a userform)
> > Range("AG" & rw) = Me.Controls("REFI" & rw)
> > The generic procedure is a sub (not a private sub) in a worksheet module.
> >
> > "Jacob Skaria" wrote:
> >
> > > I missed your point
> > >
> > > Dim rw As Long: rw = 51
> > > Range("AG" & rw) = Me.Controls("REFI" & rw)
> > >
> > > (this might be a multiple post as i got an error .)
> > > --
> > > If this post helps click Yes
> > > ---------------
> > > Jacob Skaria
> > >
> > >
> > > "Brett" wrote:
> > >
> > > > Hi Jacob, I think you may have missed my point. The procedure is a generic
> > > > one that is called by each of the comboboxes REFI1 through REFI100, so I want
> > > > to refer to REFI & rw, where rw is the value passed into the procedure.
> > > > Regards, Brett
> > > >
> > > > "Jacob Skaria" wrote:
> > > >
> > > > > If you have your combo box in your Activesheet..
> > > > >
> > > > > Dim rw As Long: rw = 51
> > > > > 'To assign the value from cell to combo
> > > > > ActiveSheet.REFI51 = Range("AG" & rw)
> > > > >
> > > > > 'To assign the value from combo to cell
> > > > > Range("AG" & rw) = ActiveSheet.REFI51
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > If this post helps click Yes
> > > > > ---------------
> > > > > Jacob Skaria
> > > > >
> > > > >
> > > > > "Brett" wrote:
> > > > >
> > > > > > I have a series of comboboxes in a sheet (REFI1, REFI23 etc). How can I make
> > > > > > the second line of code generic (i.e pass the value of rw into Me.REFI & rw)?
> > > > > > Dim rw As Long: rw = 51
> > > > > > Range("AG" & rw) = Me.REFI51
> > > > > >
> > > > > > I tried:
> > > > > > Range("AG" & rw) = Me.REFI & rw
> > > > > > but it debugs with "REFI" data member not found.
> > > > > > Thanks in advance, Brett.

 
Reply With Quote
 
Jacob Skaria
Guest
Posts: n/a
 
      9th Jun 2009
Oops...messed it more than once..The below will work Brett,,

ActiveSheet.OLEObjects("REFI" & rw).Object.Value

If this post helps click Yes
---------------
Jacob Skaria


"Brett" wrote:

> Range("AG" & rw) = Sheets("LOANS").Shapes("REFI" & rw)
> gives application defined or object defined error
>
> "Jacob Skaria" wrote:
>
> > Refer that as
> >
> > Activesheet.shapes("REFI" & rw)
> >
> > OR
> >
> > Sheets("Sheename").shapes("REFI" & rw)
> >
> >
> > If this post helps click Yes
> > ---------------
> > Jacob Skaria
> >
> >
> > "Brett" wrote:
> >
> > > That goes to debug with "Controls data member not found" (it's in a sheet,
> > > not a userform)
> > > Range("AG" & rw) = Me.Controls("REFI" & rw)
> > > The generic procedure is a sub (not a private sub) in a worksheet module.
> > >
> > > "Jacob Skaria" wrote:
> > >
> > > > I missed your point
> > > >
> > > > Dim rw As Long: rw = 51
> > > > Range("AG" & rw) = Me.Controls("REFI" & rw)
> > > >
> > > > (this might be a multiple post as i got an error .)
> > > > --
> > > > If this post helps click Yes
> > > > ---------------
> > > > Jacob Skaria
> > > >
> > > >
> > > > "Brett" wrote:
> > > >
> > > > > Hi Jacob, I think you may have missed my point. The procedure is a generic
> > > > > one that is called by each of the comboboxes REFI1 through REFI100, so I want
> > > > > to refer to REFI & rw, where rw is the value passed into the procedure.
> > > > > Regards, Brett
> > > > >
> > > > > "Jacob Skaria" wrote:
> > > > >
> > > > > > If you have your combo box in your Activesheet..
> > > > > >
> > > > > > Dim rw As Long: rw = 51
> > > > > > 'To assign the value from cell to combo
> > > > > > ActiveSheet.REFI51 = Range("AG" & rw)
> > > > > >
> > > > > > 'To assign the value from combo to cell
> > > > > > Range("AG" & rw) = ActiveSheet.REFI51
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > If this post helps click Yes
> > > > > > ---------------
> > > > > > Jacob Skaria
> > > > > >
> > > > > >
> > > > > > "Brett" wrote:
> > > > > >
> > > > > > > I have a series of comboboxes in a sheet (REFI1, REFI23 etc). How can I make
> > > > > > > the second line of code generic (i.e pass the value of rw into Me.REFI & rw)?
> > > > > > > Dim rw As Long: rw = 51
> > > > > > > Range("AG" & rw) = Me.REFI51
> > > > > > >
> > > > > > > I tried:
> > > > > > > Range("AG" & rw) = Me.REFI & rw
> > > > > > > but it debugs with "REFI" data member not found.
> > > > > > > Thanks in advance, Brett.

 
Reply With Quote
 
Brett
Guest
Posts: n/a
 
      9th Jun 2009
Yes, that seems to work. Thanks Jacob

"Jacob Skaria" wrote:

> Oops...messed it more than once..The below will work Brett,,
>
> ActiveSheet.OLEObjects("REFI" & rw).Object.Value
>
> If this post helps click Yes
> ---------------
> Jacob Skaria
>
>
> "Brett" wrote:
>
> > Range("AG" & rw) = Sheets("LOANS").Shapes("REFI" & rw)
> > gives application defined or object defined error
> >
> > "Jacob Skaria" wrote:
> >
> > > Refer that as
> > >
> > > Activesheet.shapes("REFI" & rw)
> > >
> > > OR
> > >
> > > Sheets("Sheename").shapes("REFI" & rw)
> > >
> > >
> > > If this post helps click Yes
> > > ---------------
> > > Jacob Skaria
> > >
> > >
> > > "Brett" wrote:
> > >
> > > > That goes to debug with "Controls data member not found" (it's in a sheet,
> > > > not a userform)
> > > > Range("AG" & rw) = Me.Controls("REFI" & rw)
> > > > The generic procedure is a sub (not a private sub) in a worksheet module.
> > > >
> > > > "Jacob Skaria" wrote:
> > > >
> > > > > I missed your point
> > > > >
> > > > > Dim rw As Long: rw = 51
> > > > > Range("AG" & rw) = Me.Controls("REFI" & rw)
> > > > >
> > > > > (this might be a multiple post as i got an error .)
> > > > > --
> > > > > If this post helps click Yes
> > > > > ---------------
> > > > > Jacob Skaria
> > > > >
> > > > >
> > > > > "Brett" wrote:
> > > > >
> > > > > > Hi Jacob, I think you may have missed my point. The procedure is a generic
> > > > > > one that is called by each of the comboboxes REFI1 through REFI100, so I want
> > > > > > to refer to REFI & rw, where rw is the value passed into the procedure.
> > > > > > Regards, Brett
> > > > > >
> > > > > > "Jacob Skaria" wrote:
> > > > > >
> > > > > > > If you have your combo box in your Activesheet..
> > > > > > >
> > > > > > > Dim rw As Long: rw = 51
> > > > > > > 'To assign the value from cell to combo
> > > > > > > ActiveSheet.REFI51 = Range("AG" & rw)
> > > > > > >
> > > > > > > 'To assign the value from combo to cell
> > > > > > > Range("AG" & rw) = ActiveSheet.REFI51
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --
> > > > > > > If this post helps click Yes
> > > > > > > ---------------
> > > > > > > Jacob Skaria
> > > > > > >
> > > > > > >
> > > > > > > "Brett" wrote:
> > > > > > >
> > > > > > > > I have a series of comboboxes in a sheet (REFI1, REFI23 etc). How can I make
> > > > > > > > the second line of code generic (i.e pass the value of rw into Me.REFI & rw)?
> > > > > > > > Dim rw As Long: rw = 51
> > > > > > > > Range("AG" & rw) = Me.REFI51
> > > > > > > >
> > > > > > > > I tried:
> > > > > > > > Range("AG" & rw) = Me.REFI & rw
> > > > > > > > but it debugs with "REFI" data member not found.
> > > > > > > > Thanks in advance, Brett.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Generic row reference in formula Rick Microsoft Excel Discussion 9 14th May 2007 02:23 AM
Generic Collection with reference types Ethan Strauss Microsoft C# .NET 5 24th Apr 2007 06:45 PM
Generic reference in a Macro Harry's GMail World Microsoft Excel Misc 2 17th Apr 2007 11:07 PM
Generic adjacent cell reference Paul Microsoft Excel Discussion 5 1st Dec 2005 06:29 PM
Generic ComboBox change event steve Microsoft Excel Programming 7 14th Oct 2003 07:30 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:44 AM.