Get the List of Data Name Range

NimishK

Well-known Member
Joined
Sep 4, 2015
Messages
684
Hello

How can I get a list of Data Name Range from the following representation ?
1. Columns are fixed (A:D)
2. Rows are unpredictable: TableDataName Range is also unpredictable
3. Data Name Range to be named from Firms Name ie from COL A which is hilited in bg color for reference or From COL
B ie REF Code
4. Firm’s Name will begin every 1st row in COL A after the previous Range
5. ROW 2 is the Header Row
1ABCD
2Firm NameREF CODETRANS CODEGoods Description
3ABC188fdsfdssfdsfdsfds
423dfdsdsfdsfds
5XYZ21fddsfdsdsffdsf
62fdsfkdsjfhdskjfds fhdbfdskhfdsf
73fdsfdfdsfdsfdfdds
8AAA4344fffffff44ffffffff
95555ggggggggg
1023
1177Yrtytytryrtryt
1288Fdsfdssfdsfdsfds
13TMOT5588fdsfdssfdsfdsfds

<tbody>
</tbody>

<tbody>
</tbody>



Data Name Range List will Include ABC, XYZ, AAA, TMOT with its Range as per the above representation
List to be displayed in Combo or Listbox.
for EG XYZ A5:D7

Pl excuse me if the format has not come clear

NimishK
 
Last edited:

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Peter
Small Feedback as per your code i tried with 29 columns and 1st Single Entry infact showing the Individual Row Address From header row til the range

this what was observed and
The ComboBox1.List = Ray displayed the Header Row its Address From A1:AC1 then Next in the Combolist it displayed the Header of B1 and Address B1:AD1, C1 and C1:AE1 and so on......
uptil AC1:BE2 after this it showed A2:AC3 , B2:AD3 uptil AC3:BE54
I dont know why this Happened.
Code:
Sub GetFirms()
  Dim Ray() As String
  Dim c As Range, LastA As Range
  Dim rws As Long, k As Long
  
  Set LastA = Range("A" & Range("AC" & Rows.Count).End(xlUp).Row)
  For Each c In Range("A2", Range("A" & Rows.Count).End(xlUp)).SpecialCells(xlConstants)
    rws = 1
    If IsEmpty(c.Offset(1).Value) And c.Address <> LastA.Address Then rws = rws + Range(c, LastA).SpecialCells(xlBlanks).Areas(1).Rows.Count
    k = k + 1
    ReDim Preserve Ray(1 To k)
    Ray(k) = c.Value & " " & c.Resize(rws, 29).Address(0, 0)
  Next c
  ComboBox1.List = Ray
End Sub
Extremely sorry for the trouble
 
Upvote 0
I don't have your setup, so I can't really replicate what is happening for you.
 
Upvote 0
Peter


Can you try your code with my post 1 Structure for 4 columns. Whether 4 columns or 29 columns the result observed as follows
Observed that data for ONLY 1st firm. i.e range A3:D4 only.
If the Data is blank ie from Range A4 onwards. Combobox1.list displayed the Header Row its Address From A1:D1 and thereafter it displayed address of individual rows.


I request you to kindly delete or remove the data from A4:D13 and see the results in combobox1
 
Upvote 0
I would like the best use of Combobox1_Click() event and combobox1_Change () Event

As per Structrue of worksheet as per post #10
As getting Range Address in comboBox1. So when Clicking in it how can i get a value in Textbox1 and Textbox2

Textbox1 for Eg of Cell C2 of range A2:E5
Textbox2 value oF Cell D2 of range A2:E5

When next item clicked on Combobox1
So Textbox1 should display of Cell C4 of range A4:E6
Textbox2 to display value of Cell D4 of range A4:E6

Clicked on 3rd item of combobox1 and so on
Textbox1 should display of Cell C7 of range A7:E11
Textbox2 to display value of Cell D7 of range A7:E11
and so on

and From Change_Event ()
is to type the Value of c.Value and getting the result as above

Got many errors type Mismatch, subscript out of range, Object Variable or with Block Variable not set, method range of object _global failed in Combobox1_Click event
:oops:
 
Last edited:
Upvote 0
Peter
Sorry To bother
Hope this is the Last one.
I Require the syntax to get the respective Range Address in txtRangeaddress.Text while clicking on ComboBox1 though already displaying in comboBox1.List as per your Code.
 
Upvote 0

Forum statistics

Threads
1,215,329
Messages
6,124,301
Members
449,149
Latest member
mwdbActuary

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top