Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Naming different ranges in the same column

Hi,

In my column H, I have three possibilities: Project, Support or Group. Is is possible with VBA to name a range of cells according to the data entered in those cells ?

In other words, I need to have three range of cells (that will change every day)

Before I only had one possibility which was Project which was assigned to a combobox in a userform. Therefore I used the following code:


Sub Proj()
On Error Resume Next
Dim L As Long
Sheet3.Select
With ActiveSheet()
If Range("B3").Value = "" Then Exit Sub

L = .Range("B65536").End(xlUp).Row
.Range("B2:B" & L).Name = "Proj"
End With
End Sub

Now, I want the combobox to reflect only the rows that contain the word Project or Support or Group in the column H If the user choose the checkbox Group, only the rows containing the word group in the column H should appear in the combobox. Same for Support or Project .

Any ideas ?

Thank you for your time
Denys
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Naming different ranges in the same column

Hi Claus,

Thank you so much !!! Only one thing. When I try thr following:

Private Sub CheckBox1_Click()
If CheckBox1 = True Then Combobox8.Rowsource= "Projects"
end sub

I get the message that Excel could not set the Rowsource Property. But the name appears in the name Manager..... Have I missed anything ?

Thanks again

Denys
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default Naming different ranges in the same column

Try...

If CheckBox1 = True Then Combobox8.Rowsource=Range("Projects")

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default Naming different ranges in the same column

Hi Denys,

Am Wed, 15 Apr 2015 09:53:58 -0700 (PDT) schrieb :

Private Sub CheckBox1_Click()
If CheckBox1 = True Then Combobox8.Rowsource= "Projects"
end sub


why do you need a combobox in which all entries are "Projects"?
In range("Projects") every cell has the value "Projects"


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,872
Default Naming different ranges in the same column

Hi Denys,

Am Wed, 15 Apr 2015 19:09:11 +0200 schrieb Claus Busch:

why do you need a combobox in which all entries are "Projects"?
In range("Projects") every cell has the value "Projects"


the names are sheet scope names. Rowsource has to be a string. If the
range is on Sheet1 then try:

Private Sub CheckBox1_Click()
If CheckBox1 = True Then UserForm1 _
.ComboBox8.RowSource = "Sheet1!Project"
End Sub

Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default Naming different ranges in the same column

Hi Denys,

Am Wed, 15 Apr 2015 09:53:58 -0700 (PDT) schrieb
:

Private Sub CheckBox1_Click()
If CheckBox1 = True Then Combobox8.Rowsource= "Projects"
end sub


why do you need a combobox in which all entries are "Projects"?
In range("Projects") every cell has the value "Projects"


Regards
Claus B.


Probably needs to be more like...

If CheckBox1 = True Then Combobox8.List = Split(strData, ",")

--
Garry

Free usenet access at
http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Naming different ranges in the same column

Oh! boy !!!
I am not going to win an oscar on this one !!!!!
I forgot to mention that in the combobox the list should be taken on the column B if the value in Column H is Group....or Projects This is why I needed to have the different names, so only the ones corresponding should appear in the combobox...

It is true that it did not make any sense to have a dropdown with all the same word into it !!!

So I presume theere should be an offsett somewhere...

Thank you again

Denys
  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Naming different ranges in the same column

Here's where I stand for now:

But so far, everything appears on the list....not only the range Group...

Private Sub ComboBox8_Change()

Nom = ComboBox8
Dim c
With Sheet3.Range("Group")
Set c = .Find(What:=Nom, After:=Sheet3.Range("B3"), LookIn:=xlValues, LookAt:=xlWhole)
If Not c Is Nothing Then
fistA = c.Address
Application.GoTo Reference:=Sheet3.Range(c.Address)
End If
Me.ComboBox8.Value = ActiveCell.Value
Me.TextBox4.Value = ActiveCell.Offset(0, 11).Value
Me.TextBox5.Value = ActiveCell.Offset(0, 12).Value
Me.TextBox6.Value = ActiveCell.Offset(0, 9).Text
Me.TextBox7.Value = ActiveCell.Offset(0, 17).Text
'Sheet1.Range("J1").Value = Me.TextBox6.Value''

End With
Sheet1.Select
End Sub

It should have captured only the last four of the list !!!!

Denys
  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Naming different ranges in the same column

OK Claus.... I'll work on this and come back.... In the meantime... Thank you for your time

Denys
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
naming ranges Ken Wright Excel Worksheet Functions 0 November 30th 06 07:48 AM
naming ranges Gary''s Student Excel Worksheet Functions 0 November 29th 06 11:26 PM
naming ranges TechyTemp Excel Worksheet Functions 0 November 29th 06 09:18 PM
Naming Ranges Simon Shaw Excel Discussion (Misc queries) 1 February 15th 05 01:17 AM
Naming Ranges Donna In Denver Excel Discussion (Misc queries) 1 January 28th 05 07:48 AM


All times are GMT +1. The time now is 03:25 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"