Here's a test file based on some of the assumptions below.
It's in Excel 2010 format.

If you need Excel97/2003 let me know.
 
Paul
-----------------------------------------
“Do all the good you can,
By all the means you can,
In all the ways you can,
In all the places you can,
At all the times you can,
To all the people you can,
As long as ever you can.” - John Wesley
-----------------------------------------




________________________________
From: Paul Schreiner <schreiner_p...@att.net>
To: excel-macros@googlegroups.com
Sent: Thu, December 6, 2012 9:15:39 AM
Subject: Re: $$Excel-Macros$$ Convert a CSV data string into Rows & Columns


I have a couple of questions for you:

1) How do you obtain the string?
   If that's not important for this exercise (you'll supply the string), I can 
use StrValue as the variable and your can set this value however you may.
2) I believe you're saying that you want the user to enter the number of 
rows/columns desired.
   I would suggest determining the number of values, then use a userform to 
enter the row/column values.
   That way, if they enter the number of rows, the number of columns will be 
adjusted to match.
   If they change the number of columns, the number of rows will be adjusted.

3) How do you want to fill the matrix?
   Fill across the columns first (in row 1) before moving to the next row, or
   Fill the rows vertically before moving to the next column?
 
Paul
-----------------------------------------
“Do all the good you can,
By all the means you can,
In all the ways you can,
In all the places you can,
At all the times you can,
To all the people you can,
As long as ever you can.” - John Wesley
-----------------------------------------




________________________________
From: Jewel Sharma <jewelsha...@gmail.com>
To: excel-macros@googlegroups.com
Sent: Thu, December 6, 2012 1:22:28 AM
Subject: $$Excel-Macros$$ Convert a CSV data string into Rows & Columns

Hi All,


I have a string with comma separated values (say N values)
(E.g. 233, 127, 139, 38, 560, 72, 56, 67, 45, 232, 28, 242, 344, 234, 034, 072, 
342, 34, 5, 34, 34, 6, 782, 342, 34, 234, 2, 423, 45, 23, 21, 56, 03, 08, 56, 
22, 94, 22.4, 23.1, 40, 45, 242, 475, 21, 24, 23, 423, 444, 24, 75, 67)

I would like to build a macro that does the following:
        1. Breaks this string values into individual cells (say 1 row X N 
columns, or 1 
column X N rows).
        2. It ask the user to enter the no. of rows (say P) and no. of columns 
(say Q); 
and then moves the data into "P" Rows X "Q" Columns.
        3. it should check that N = P X Q (just to confirm that the data will 
fit into 
P X Q table).
For E.g. the above e.g. data string has 36 values, the macro should be able to 
covert these into a 1 X 36, 2 X 18, 3 X 12, 4 X 9, 6 X 6, 9 X 4, 12 X 3, 18 X 2 
and 36 X 1 rows and columns, as per the rows & columns desired by the user.

I believe this should be doable using a combination of "UBound" and "Offset", 
but I'm just not able to piece together the logic.

Cheers !
Jewel-- 
Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel
 
FORUM RULES
 
1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.
 
NOTE : Don't ever post confidential data in a workbook. Forum owners and 
members 
are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To post to this group, send email to excel-macros@googlegroups.com.
To unsubscribe from this group, send email to 
excel-macros+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros?hl=en.
 
 
-- 
Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel
 
FORUM RULES
 
1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.
 
NOTE : Don't ever post confidential data in a workbook. Forum owners and 
members 
are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To post to this group, send email to excel-macros@googlegroups.com.
To unsubscribe from this group, send email to 
excel-macros+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros?hl=en.

-- 
Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups "MS 
EXCEL AND VBA MACROS" group.
To post to this group, send email to excel-macros@googlegroups.com.
To unsubscribe from this group, send email to 
excel-macros+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros?hl=en.


Attachment: LoadMatrix.xlsb
Description: application/vnd.ms-excel.sheet.binary.macroenabled.12

Reply via email to