Flyingduck
New Member
- Joined
- Apr 2, 2019
- Messages
- 3
Hello all,
I've been working on the vba code for a work project.
I've done this multiple times before for similar projects but this one is slightly different.
Previously there was one group of entries, with 4 specific variables that had to be entered in order for the program to be ran.
This has worked just fine for me, but now I have two group of entries with 4 variables each.
If all 4 variables are entered for either group I need the program to run without making a change to the other group of variables if at all possible.
Is there anyway I can achieve this?
I pasted the code I have below, at this point in time it's not working.
I'm wondering if there is any sort of method of getting it to do what I need?
Best regards,
FlyingDuck
I've been working on the vba code for a work project.
I've done this multiple times before for similar projects but this one is slightly different.
Previously there was one group of entries, with 4 specific variables that had to be entered in order for the program to be ran.
This has worked just fine for me, but now I have two group of entries with 4 variables each.
If all 4 variables are entered for either group I need the program to run without making a change to the other group of variables if at all possible.
Is there anyway I can achieve this?
I pasted the code I have below, at this point in time it's not working.
I'm wondering if there is any sort of method of getting it to do what I need?
Best regards,
FlyingDuck
Code:
Sub WorkSheet_Change(ByVal Target As Range)
Dim rng As Range
Dim r As Range
Dim bcellsfilled As Boolean
If Sheets("T Generator").Range("C10").Value <> 0 And Sheets("T Generator").Range("C11").Value <> 0 And Sheets("T Generator").Range("C12").Value <> 0 And Sheets("T Generator").Range("C13").Value <> ""Then
Set rng = Sheets("T Generator").Range("C10, C11, C12, C13")
End If
'If Sheets("T Generator").Range("C61").Value <> 0 And Sheets("T Generator").Range("C62").Value <> 0 And Sheets("T Generator").Range("C63").Value <> 0 And Sheets("T Generator").Range("C64").Value <> 0 Then
'Set rng = Sheets("T Generator").Range("C61, C62, C63, C64")
'End If
Application.ScreenUpdating = False
If Not Intersect(rng, Target) Is Nothing Then
bcellsfilled = True
For Each r In rng
If r.Value = "" Then
bcellsfilled = False
End If
Next r
If bcellsfilled = True Then
Call Macro1
Sheets("T Generator").Range("c13").ClearContents
End If
'If bcellsfilled = True And rng = Sheets("T Generator").Range("C61, C62, C63, C64") Then
'Call Macro2
'Sheets("T Generator").Range("C64").ClearContents
'End If
If Sheets("T Generator").Range("C10").Value <> "" And Sheets("T Generator").Range("C11").Value <> "" And Sheets("T Generator").Range("C12").Value <> "" And rng = Sheets("T Generator").Range("C10, C11, C12, C13") Then
Call Plasticdata
End If
'If Sheets("T Generator").Range("C61").Value <> "" And Sheets("T Generator").Range("C62").Value <> "" And Sheets("T Generator").Range("C63").Value <> "" And rng = Sheets("T Generator").Range("C61, C62, C63, C64") Then
'Call Plasticdata2
'End If
End If
End Sub
Last edited by a moderator: