I am trying to write code that looks at a value, and based on the value ("OPGW" or "Conductor") runs either the OPGW macro or the Conductor macro in another cell further to the right. Then I want it to move down to the next line and do it all again.
So if Cell B8 is OPGW, I want Cell BG8 to run the OPGW code, and then if cell B9 is Conductor, I want cell BG9 to run the Conductor code. There's no problem with the individual macros, though it should be noted that each macro is an exceedingly long formula that SHOULD only take place in the active cell. The only problem I'm having is that it won't go down to the next row and do it all again.
Sub WireUpdate()
N = Cells(Rows.Count, "A").End(xlUp).Row
CR = ActiveCell.Row()
With Range("BG8:BG" & N)
If ActiveSheet.Cells(CR, 2) = "OPGW" Then
Call OPGW2
Else: Call Conductor2
End If
End With
Thank you so much for your help.
I have tried the following code
With Range("BG8:BG" & N)
If ActiveSheet.Cells(CR, 2) = "OPGW" Then
Call OPGW2
Else
If ActiveSheet.Cells(CR, 2) = "Conductor" Then
Call Conductor2
Else: ActiveSheet.Cells(CR, 2) = "0"
End If
End If
End With
I have also tried to make the OPGW and Conductor macros loop, which works, but tends to overwrite the other data. So, it will put in all the OPGW things in, then go through and put all the Conductor things in, overwriting the OPGW things with 0.
I also checked out the following article: Running Different Macros Based on Values in Range but it didn't seem to be what I need, unless it can be adapted in a way I haven't fathomed yet.