PC Review


Reply
Thread Tools Rate Thread

columns in refedit to a combobox

 
 
=?Utf-8?B?THVpc0U=?=
Guest
Posts: n/a
 
      30th Sep 2007
How can I populate a ComboBox with the columns of a range selected in a
RedEdit?

Thanks in advance
 
Reply With Quote
 
 
 
 
=?Utf-8?B?Sm9lbA==?=
Guest
Posts: n/a
 
      1st Oct 2007
with userform1
.combobox1.text = .refedit1.text
end with

lets say the string return is
refeditrange = "sheet1!$A5:$B10"
You can extract the columns using string references or cell references

set cellrange = range(refeditrange)
firstcol = cellrange.column
lastcolumn = firstcol + cellrange.columns - 1

you can do the same using string manipulations

Sub test()

refeditrange = "sheet1!$A5:$B10"

'get everything after first $
Firstcol = Mid(refeditrange, _
InStr(refeditrange, "$") + 1)
Lastcol = Firstcol
'check if column is one letter of two letters
If IsNumeric(Mid(Firstcol, 2, 1)) Then
'Column is A - Z
Firstcol = Left(Firstcol, 1)
Else
'Column is AA - IV
Firstcol = Left(Firstcol, 2)
End If
'get characters after 2nd $
Lastcol = Mid(Lastcol, _
InStr(Lastcol, "$") + 1)
If IsNumeric(Mid(Lastcol, 2, 1)) Then
'Column is A - Z
Lastcol = Left(Lastcol, 1)
Else
'Column is AA - IV
Lastcol = Left(Lastcol, 2)
End If

End Sub
"LuisE" wrote:

> How can I populate a ComboBox with the columns of a range selected in a
> RedEdit?
>
> Thanks in advance

 
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
Userform RefEdit updating ComboBox values =?Utf-8?B?TWFrZUxlaQ==?= Microsoft Excel Programming 1 15th Nov 2006 02:43 PM
To refedit, or not to refedit, that is the question. davegb Microsoft Excel Programming 2 25th Oct 2006 08:19 PM
Help with ComboBox columns fiaolle Microsoft VB .NET 1 6th Aug 2006 11:37 PM
Many Columns in a combobox? Lars Netzel Microsoft VB .NET 1 3rd May 2004 11:53 AM
combobox with two columns Robin Heinrich Microsoft Outlook VBA Programming 0 19th Sep 2003 01:41 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:48 AM.