0

So I have this code below which looks at the B column for specific strings. Based on the string result, the code will do some multiplication and place the result in either the J column or K column, depending on what string was found. My questions pertains to the first part of code where "supplier" is found. When the code performs the math it moves the result to the K column, for every "supplier" found in col B. I want it to also turn the text red, make it currency, and place the total underneath the data. How do I do this? Thank you very much for looking.

enter image description here

Sub SplitUp()

    For i = 8 To 200                                   
        If cells(i, 2).Value = "supplier" Then    
            cells(i, 11) = cells(i, 13) * cells(i, 4)   
          
        Else
            If cells(i, 2).Value = "manufacture" Then
                cells(i, 10) = cells(i, 13) * cells(i, 4)
            Else

            End If
        
        End If
    
    Next i

End Sub
  • add a screenshot of data with expected output – Gangula Oct 15 '21 at 13:41
  • Use `Select` and scrap all those if/else statements. – Kostas K. Oct 15 '21 at 13:46
  • @KostasK. `Select` is generally considered bad practice and I don't see how it would replace the use if `If...Else` here. – jsheeran Oct 15 '21 at 13:59
  • This sounds like something the Macro Recorder can help you – Gangula Oct 15 '21 at 14:07
  • @jsheeran `Select` considered bad practice? By whom? On the contrary, it makes the code much cleaner and easier to debug. – Kostas K. Oct 15 '21 at 15:43
  • @KostasK. Have a read of [How to avoid using Select in VBA](https://stackoverflow.com/questions/10714251/how-to-avoid-using-select-in-excel-vba). There may be situations where it's unavoidable, but most of the time It does the exact opposite of making the code cleaner and easier to debug. – jsheeran Oct 18 '21 at 07:19
  • @jsheeran I'm referring to `Select Case [...]`. – Kostas K. Oct 18 '21 at 07:52
  • Ok thanks for the tips, I will look into the select case and hopefully figure this one out. – user14302065 Oct 18 '21 at 12:25

0 Answers0