creating new arrays within an over-arching array

shabbyporpoise

New Member
Joined
Jul 22, 2011
Messages
26
Hello Forum:)

I'm attempting to develop a vba program that will create an over-arching array that loops and creates other arrays along the way. The end goal is so that I can reference the cells in the arrays and compare them with other cells in the other arrays. I'm including the code that I have so far, any tips or starting points are welcome
Code:
Option Explicit

Sub mainFireWall()
    Dim num As Integer, names As String, i As Integer
    Dim colCount As Variant, rule()
    Dim col As Integer
    Dim row As Integer
    Dim rowCount As Integer
    
    row = 1
    i = 1
    num = InputBox("how many rules are in this document?")
    For rowCount = 1 To num
    
  
    
        Do Until IsEmpty(Cells(row, i))
             ReDim Preserve rule(1 To i)
            rule(i) = Cells(1, i).Value
             i = i + 1
            
         Loop
         row = row + 1
         MsgBox rule(3) 'I'm using this as a test
         
    Next rowCount
    
End Sub
Thanks Forum, any help is much appreciated

ShabbyPorpoise
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
I reviewed your code thus far and was wondering if u had worked on this any more. It would be helpful to see where you are ultimately going so that we can provide better feedback. As a general note though - if the # of rules are fixed - you might want to try using public variables as all the redim ones have don't transfer out as easily (although there are always way to do it including creating a temp file on your computer or a shared drive).

If you send me more info - I'll try to provide better suggestions.
Ben
 
Upvote 0
Hi bfarley4. Thanks for your post. Sorry I didn't respond sooner. Been on vacation, now I'm back at it!

Anyway I was doing some work while on airplanes and such and actually came up with a solution to my issue.
This the code that I came up with. Thanks again for your post!!!!:cool:
Code:
Sub Ai()
    num = InputBox("how many?")
    
   For intRow = 1 To num
   For intColumn = 1 To 6
        rules(intRow, intColumn) = Cells(intRow, intColumn).Value
    
    
    
     Next intColumn
    Next intRow
    
    x = 1
    a = 2
    k = 2
    i = 2
    Do Until k = num
    For x = i To num
        If rules(k, a) = rules(x, a) Then
            'MsgBox "something worked for a change"
            'MsgBox rules(x, a)
            If Cells(k, a).Address <> Cells(x, a).Address Then
                
                MsgBox rules(k, a) & " MATCHES " & rules(x, a)
                Call Bi
            End If
            
        Else
           ' MsgBox "not a match"
            MsgBox rules(k, a) & " does not match " & rules(x, a)
            
            'Call none
        End If
        
    Next x
    k = k + 1
    i = i + 1
    Loop
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,599
Messages
6,179,827
Members
452,946
Latest member
JoseDavid

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top