Announcements
Due to scheduled maintenance, the Autodesk Community will be inaccessible from 10:00PM PDT on Oct 16th for approximately 1 hour. We appreciate your patience during this time.
VBA
Discuss AutoCAD ActiveX and VBA (Visual Basic for Applications) questions here.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to get Excel data in order - without first row

3 REPLIES 3
Reply
Message 1 of 4
m09366023695
266 Views, 3 Replies

How to get Excel data in order - without first row

I have an excel like this:

 

excel1.JPG

 

but I want to get all data inside an array without first rows (left to right):

 

excel2.JPG

Labels (2)
3 REPLIES 3
Message 2 of 4
ed57gmc
in reply to: m09366023695

Are you saying that you want A1,B1,C1,C2,C3? And not A1,B1,C1,A2,B2,C2,A3,B3,C3? If you want something different, please give us a list.

 

One simple way is to check each cell's Value property and if it equals "" ( an empty string), then don't add it to the array.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

Message 3 of 4
m09366023695
in reply to: ed57gmc

I don't want A1,B1,C1 etc.

I want A2,B2,C2,C3,C4,D2.

Message 4 of 4
ed57gmc
in reply to: m09366023695

I would create a Range from the selected cells, and then iterate the range to add cells to an array. If you select the cells with your mouse, as you did in the picture, you can right click and select "Define Name". This creates a named range. You can also create a Range object in code.

Ed


Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
How to post your code.

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report