Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 133
Default columns in refedit to a combobox

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

Thanks in advance
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default columns in refedit to a combobox

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
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
columns Widths for ComboBox jlclyde Excel Discussion (Misc queries) 2 October 14th 09 05:05 PM
combobox multiple columns Graham Y Excel Programming 3 September 25th 07 03:19 PM
Userform RefEdit updating ComboBox values MakeLei Excel Programming 1 November 15th 06 02:43 PM
To refedit, or not to refedit, that is the question. davegb Excel Programming 2 October 25th 06 08:19 PM
combobox with columns JT[_2_] Excel Programming 2 February 15th 05 11:01 PM


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

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

About Us

"It's about Microsoft Excel"