Results 1 to 6 of 6

Thread: Change column

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    How can I get this to work


    Sub addClassAll()
      Dim sht As Worksheet
      Dim Where As Range
      For Each sht In Worksheets
        With sht
          Set Where = .Range("C" & .Rows.Count).End(xlUp)
          Set Where = .Range("J1", .Range("J" & Where.Row))
        End With
        With sht.Range("J1")
          .FormulaR1C1 = _
            "=IF(LEFT(RC[-7],1)=""1"",""1 Sales"",IF(LEFT(RC[-7],1)=""3"",""5 Rest"",IF(LEFT(RC[-7],1)=""2"",""6 Institute"",IF(LEFT(RC[-6],1)=""1"",""3 Class KKB"",IF(LEFT(RC[-7],1)=""4"",""1 Sales"", """"""))))))"
          If Where.Rows.Count > 1 Then
            .AutoFill Destination:=Where, Type:=xlFillDefault
          End If
        End With
      Next
    End Sub



    Ok I dont think I was right. So back to the first task.

    Really all I need is it to search column D and if it starts with a 1 to put "3 Class KKB" in the same row in column J.

    How ever I can get that done. The current module I use is attached to the first post. Either edit that one or create a new one. Both will be ok for me

    Thanks




    One other thing I dont like about this module is that it leaves the code in the cell. If I click in column j rather than see the text I see the code. If this can be made so only the text is left in the column not the code that would be great. That is a secondary task. It works fine as is just something I wanted to add.
    Last edited by Paul_Hossler; 01-18-2021 at 05:09 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •