Link to home
Start Free TrialLog in
Avatar of sadupops
sadupops

asked on

VB excel ROWS and COLUMNS

In the function below i am trying to loop through an array of cells (Rows and Columns). I select the desired columns and i loop through the cells in that row in the columns i have chosen, then i move on to the next row and i do the same thing again.

for example
Col A  Col D  Col G
  2        4        5
  3                  1
            9

select/input columns A:D:G
select/input rows      1:2:3

what am doing is, the columns are stored in an array and the rows are stored in an array.
i want to have a nested for loop that loops thorugh the rows one by one. in the first row, the inner for loop goes thorugh each cell on that row to check if there is a value in it. the second row it does the same with the same columns selected.

CAN ANYONE help

how can this be done in VB
Function Coo(dat1() As Variant, dat2() As Variant) As Variant 'data2 As Variant, data3 As Variant) As Variant
'Dim cell As Range
Dim intI
Dim d
'For intI = 0 To UBound(dat1)
'For i = 1 To Range.Cells.Count
'For Each d In dat2
For Each intI In dat1
If intI Then
Coo = intI
Exit For
End If
Next intI
'Next d
End Function
ASKER CERTIFIED SOLUTION
Avatar of jimbobmcgee
jimbobmcgee
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sadupops
sadupops

ASKER

i need to go by row then column.
if i select cells
i want to go thorugh the cells row after row
then the second row
then the third

comparing all the cells in each row and getting some output to print into a selected column

PLS I NEED A SOLUTIONAS SOON AS POSSIBLE
Do you still need help with this?