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.
The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.
- 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.