Results 1 to 3 of 3

Applying code to entire column

Threaded View

  1. #1
    Registered User
    Join Date
    05-17-2012
    Location
    sydney, australia
    MS-Off Ver
    excel 2007/2010
    Posts
    1

    Applying code to entire column

    Hi Guys,

    I'm pretty new to vba, and i've written some code which works fine apart from i need it to run down an entire column, as it stands it's just one cell.

    Here's a section of the code, it is considerably longer but it's pretty much repeating the same format just looking for different data.
    Sub subConfig()
    Dim subConfig As String
    subConfig = "AB4"
    
        If Range("K4").Value = "CD" And Range("L4").Value = "1" Then
            Range(subConfig).Value = "5"
        ElseIf Range("K4").Value = "CD" And Range("L4").Value = "2" Then
        Range(subConfig).Value = "D"
        ElseIf Range("K4").Value = "CD" And Range("L4").Value = "3" Or Range("L4").Value = "4" Then
        Range(subConfig).Value = "H"
        ElseIf Range("K4").Value = "CD" And Range("L4").Value = "5" Then
        Range(subConfig).Value = "G"
        ElseIf Range("K4").Value = "CD" And Range("L4").Value = "6" Or Range("L4") = "7" Or Range("L4") = "8" Then
           Range(subConfig).Value = "R"
        ElseIf Range("K4").Value = "CD" And Range("L4").Value = "9" Or Range("L4") = "10" Or Range("L4") = "11" Or Range("L4") = "12" Then
           Range(subConfig).Value = "T"
    I've tried a few a couple of ways to apply it to the column but it just seems to crash or error. Any help is hugely appreciated
    Last edited by arlu1201; 05-17-2012 at 02:54 AM. Reason: Please put code tags in future.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1