Results 1 to 10 of 10

My Excel 2003 vba code does not work in excel 2010. Somebody help!

Threaded View

DeNam My Excel 2003 vba code does... 01-31-2013, 08:07 AM
alansidman Re: My Excel 2003 vba code... 01-31-2013, 08:26 AM
DeNam Re: My Excel 2003 vba code... 01-31-2013, 02:49 PM
bloodmeat Re: My Excel 2003 vba code... 02-01-2013, 01:44 AM
DeNam Re: My Excel 2003 vba code... 02-01-2013, 06:48 AM
alansidman Re: My Excel 2003 vba code... 02-01-2013, 08:46 AM
DeNam Re: My Excel 2003 vba code... 02-01-2013, 09:16 AM
JosephP Re: My Excel 2003 vba code... 02-01-2013, 09:03 AM
DeNam Re: My Excel 2003 vba code... 02-01-2013, 09:10 AM
JosephP Re: My Excel 2003 vba code... 02-01-2013, 10:05 AM
  1. #1
    Registered User
    Join Date
    01-31-2013
    Location
    Sweden
    MS-Off Ver
    Excel 2003/Excel 2010
    Posts
    64

    My Excel 2003 vba code does not work in excel 2010. Somebody help!

    Private Sub Worksheet_Change(ByVal Target As Range)
    
    
    'Om arbetsbladet är låst
    
    If ActiveSheet.ProtectContents = True Then
    
        UnprotectSheet
        
        'Subventioner VGS till VFS
    
        If Not Intersect(Target, Range("G24")) Is Nothing Then
           
    
    
                If Cells(24, 7) = "Subvention i ränta, %" Then
    
                Cells(24, 10).NumberFormat = "0.00%"
                Cells(24, 10).Value = 0.01
     
       
                Else
    
                Cells(24, 10).NumberFormat = "#,##0 $"
                Cells(24, 10).Value = 1
    
        
                End If
    
            
        
    
        End If
        
        'Kampanjvilkor
    
        If Not Intersect(Target, Range("D34, E34")) Is Nothing And (Cells(34, 4) = "Nej" Or Cells(34, 4) = "Ja, annan part") Then
        Cells(34, 5).Value = 0#
    
        End If
    
        If Not Intersect(Target, Range("D35, E35")) Is Nothing And (Cells(35, 4) = "Nej" Or Cells(35, 4) = "Ja, annan part") Then
        Cells(35, 5).Value = 0#
    
        End If
    
        If Not Intersect(Target, Range("D36, E36")) Is Nothing And (Cells(36, 4) = "Standardavgifter" Or Cells(36, 4) = "Huvudavtal") Then
        Cells(36, 5).ClearContents
    
        End If
    
        If Not Intersect(Target, Range("D37, E37")) Is Nothing And (Cells(37, 4) = "Standardavgifter" Or Cells(36, 4) = "Huvudavtal") Then
        Cells(37, 5).ClearContents
    
        End If
        
        If Not Intersect(Target, Range("D36")) Is Nothing And Cells(36, 4) = "Annat pris" Then
        Cells(36, 5).Value = 0#
    
        End If
    
        If Not Intersect(Target, Range("D37")) Is Nothing And Cells(37, 4) = "Annat pris" Then
        Cells(37, 5).Value = 0#
    
        End If
    
    
    
        ProtectSheet
    
    
    'Om arbetsbladet är olåst
    
    Else
    
    
        'Subventioner VGS till VFS
        
        If Not Intersect(Target, Range("G24")) Is Nothing Then
           
    
    
                If Cells(24, 7) = "Subvention i ränta, %" Then
    
                Cells(24, 10).NumberFormat = "0.00%"
                Cells(24, 10).Value = 0.01
     
       
                Else
    
                Cells(24, 10).NumberFormat = "#,##0 $"
                Cells(24, 10).Value = 1
    
        
                End If
    
            
        
    
        End If
    
    
        'Kampanjvilkor
        
        If Not Intersect(Target, Range("D34, E34")) Is Nothing And (Cells(34, 4) = "Nej" Or Cells(34, 4) = "Ja, annan part") Then
        Cells(34, 5).Value = 0#
    
        End If
    
        If Not Intersect(Target, Range("D35, E35")) Is Nothing And (Cells(35, 4) = "Nej" Or Cells(35, 4) = "Ja, annan part") Then
        Cells(35, 5).Value = 0#
    
        End If
    
        If Not Intersect(Target, Range("D36, E36")) Is Nothing And (Cells(36, 4) = "Standardavgifter" Or Cells(36, 4) = "Huvudavtal") Then
        Cells(36, 5).ClearContents
    
        End If
    
        If Not Intersect(Target, Range("D37, E37")) Is Nothing And (Cells(37, 4) = "Standardavgifter" Or Cells(36, 4) = "Huvudavtal") Then
        Cells(37, 5).ClearContents
    
        End If
        
        If Not Intersect(Target, Range("D36")) Is Nothing And Cells(36, 4) = "Annat pris" Then
        Cells(36, 5).Value = 0#
    
        End If
    
        If Not Intersect(Target, Range("D37")) Is Nothing And Cells(37, 4) = "Annat pris" Then
        Cells(37, 5).Value = 0#
    
        End If
    
    End If
    
    End Sub
    Does anyone know what the problem is?
    Last edited by JosephP; 02-01-2013 at 09:02 AM. Reason: add code tags

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