silentwolf
Well-known Member
- Joined
- May 14, 2008
- Messages
- 1,216
- Office Version
- 2016
Hi guys,
it has been a while since I have been here so I hope all of you are well!
In my worksheet first Row are about 10 columns filled with header data.
I like to create a condition so the code only runs if those cells have certain values.
For example
A1 (IBAN)
B1 (Auszugsnummer)
C1 (Buchungsdatum)
D1 (Valudadatum)
E1 (Umsatzzeit)
and so on..
So what could be the easiest or the best way of creating a conditon so the Code only runs if all 10 Cells in the header row meat this condition if not run a different code or exit out of it.
I found some help on here where the first rows are populated in a string Array.
Something like that.. but how can I put that all together to create a safeguard so the Code wont run if those header cells are not given or different pupulated.
Hope this is understandable and someone could give me a littel help with it.
Many Thanks
Albert
it has been a while since I have been here so I hope all of you are well!
In my worksheet first Row are about 10 columns filled with header data.
I like to create a condition so the code only runs if those cells have certain values.
For example
A1 (IBAN)
B1 (Auszugsnummer)
C1 (Buchungsdatum)
D1 (Valudadatum)
E1 (Umsatzzeit)
and so on..
So what could be the easiest or the best way of creating a conditon so the Code only runs if all 10 Cells in the header row meat this condition if not run a different code or exit out of it.
I found some help on here where the first rows are populated in a string Array.
VBA Code:
Sub datacollect()
Dim heading() As String
Dim i As Integer
Dim x As Variant
i = -1
For Each x In rows(1).Cells
If x.value = "" Then Exit For
i = i + 1
ReDim Preserve heading(i) As String
heading(i) = x.value
Next x
End Sub
Something like that.. but how can I put that all together to create a safeguard so the Code wont run if those header cells are not given or different pupulated.
Hope this is understandable and someone could give me a littel help with it.
Many Thanks
Albert