mkvarious
New Member
- Joined
- Jan 24, 2013
- Messages
- 44
hello,
I have a column with data that I work with (let's call it A).
Based on A I get data from AS400 PCCOM IBM emulator (let's call it B).
What I need to check on is whether B data is unique or not.
If B is a duplicate, then I need to check whether C column (value known from the beginning) ins'nt unique.
If C is unique, then I musn't do anything with it, as I can only do a change for B when B is unique or when B isn't unique but then C must be a duplicate, only.
When B isn't unique and when C is unique is a scenario which I cannot follow up.
But not too complicate things, let's just focus on two-dimension array, so pls disregard I have mentioned C, for now.
So my macro goes though A items and is getting B data each time ralated A item is being worked with, so I cannot have a static array with B items as they are not know from the beginning.
So I am trying to build a dynamic array with B items.
I cannot figure it out why ReDim Preserve does't work for me.
Can someone please take a peek into the code below and advise???
thanks
I have a column with data that I work with (let's call it A).
Based on A I get data from AS400 PCCOM IBM emulator (let's call it B).
What I need to check on is whether B data is unique or not.
If B is a duplicate, then I need to check whether C column (value known from the beginning) ins'nt unique.
If C is unique, then I musn't do anything with it, as I can only do a change for B when B is unique or when B isn't unique but then C must be a duplicate, only.
When B isn't unique and when C is unique is a scenario which I cannot follow up.
But not too complicate things, let's just focus on two-dimension array, so pls disregard I have mentioned C, for now.
So my macro goes though A items and is getting B data each time ralated A item is being worked with, so I cannot have a static array with B items as they are not know from the beginning.
So I am trying to build a dynamic array with B items.
I cannot figure it out why ReDim Preserve does't work for me.
Can someone please take a peek into the code below and advise???
thanks
Code:
Sub testowe()
Dim cell
Dim aTabl()
Dim rSOjeden, rSHIPTOjeden, rSOkolejny, rSHIPTOkolejny
Dim lKtóry As Long
For Each cell In Selection
lKtóry = lKtóry + 1
Select Case lKtóry
Case Is = 1
rSOjeden = cell.Offset(0, 6).Value
rSHIPTOjeden = cell.Offset(0, 4).Value
aTabl = Array(rSOjeden, rSHIPTOjeden)
Case Else
rSOkolejny = cell.Offset(0, 6)
rSHIPTOkolejny = cell.Offset(0, 4)
ReDim Preserve aTabl(rSOjeden to rSOkolejny, rSHIPTOjeden to rSHIPTOkolejny)
End Select
Next cell
End Sub