Need to edge out the competition for your dream job? Train for certifications today.
Experts Exchange Solution brought to you by
"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.
Dim wb As Excel.Workbook
Set wb = ThisWorkbook
Dim ws As Excel.Worksheet
Set ws = wb.Worksheets(1)
Dim rng As Excel.Range
Set rng = ws.Range("A1:L500")
'// retrieve range data in a 2D array
Dim data() As Variant
data = rng.Value
Dim i As Long
Dim j As Long
For i = Lbound(data, 1) To Ubound(data, 1)
For j = Lbound(data, 2) To Ubound(data, 2)
'// Manipulate your data here
'// write data back to the worksheet
rng.Value = data
Open in new window
Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.
Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.
- sheet1 has 9 columns and and 5 rows (A1:I5).
- the first row of columns hold values to be used to compare as we read from row 2 to 5
- start read first of data row1, columnA thru row1, columnA
- we hold the values of said row/columns to compare with everything else to be read
- start reading the rest...
- read row2, columnA
- compare the contents with "row1, columnA" (for example if "row2, columnA" contents = "row1, columnA")
- if true, write "row1, columnA" to sheet2 "row1, columnA"
- then read the next
- read row2, columnB
- compare the contents with "row1, columnB" (for example if "row2, columnB" contents = "row1, columnB")
- if true, write "row2, columnB" to sheet2 "row2, columnB"
- do these for all columns
Dim vTable(700, 700)
For c = 1 To 5
For r = 1 To 9
vTable(c, r) = Cells(c, r)
your code seems to hold the range of columns/rows
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment