+ Reply to Thread
Results 1 to 2 of 2

select case

Hybrid View

copythat select case 12-16-2011, 02:00 PM
TMS Re: select case 12-16-2011, 03:08 PM
  1. #1
    Registered User
    Join Date
    10-07-2011
    Location
    N/A
    MS-Off Ver
    Excel 2010
    Posts
    54

    select case

    Hello,

    I have data in row 2 (column A to Z). I would like to add a number to row 3 (corresponding column) upon the data in row 2.


    Private Sub excurate_mass()
    
    Application.ScreenUpdating = False
    
    Dim i As Long
    For i = 1 To 26
    
                
    If Not Cells(2, i) = "" Then
    
        Select Case Cells(2, i).Value
    
    Case A
        Set Cells(3, i) = "71.037114"
        
    Case C
        Set Cells(3, i) = "724"
        
    
    End Select
    
    Else: Exit Sub
    End If
    
          
    Next i
    
    Application.ScreenUpdating = True
    
    End Sub
    the code is not working. any help would be appreciated.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,440

    Re: select case

    Try:

    Private Sub excurate_mass()
    
    Application.ScreenUpdating = False
    Dim i As Long
    For i = 1 To 26
        If Not Cells(2, i) = "" Then
            Select Case Cells(2, i).Value
                Case "A"
                    Cells(3, i) = "71.037114"
                Case "C"
                    Cells(3, i) = "724"
            End Select
        Else
            Exit Sub
        End If
    Next i
    Application.ScreenUpdating = True
    End Sub

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


+ Reply to Thread

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