Code that worked in Office 2007 dosn't in 2010

MaxK38

New Member
Joined
Feb 18, 2010
Messages
37
My problem is that this code runs against the values and "C" is alwayse nothing so the other parts never have any values. Please help.

Code:
'Review ADM for exceptions
        Application.Worksheets("ADM").Activate
        With Worksheets("ADM").Range("A2:E1000")
            C = .Find("(" & DRef & ")", LookIn:=xlValues)
            If Not C Is Nothing Then
            firstAddress = C.Address
            'Test finding exceptions
            MsgBox (firstAddress)
            Do
                Set Tval = Worksheets("ADM").Range(C.Address)
                RTval = Right(Tval, Len(Tval) - InStr(1, Tval, ")"))
                Expt = Cells(1, Tval.Column).Value
                
                Select Case Expt
                    Case "SEG"
                        Col = "C"
                    Case "Customer"
                        Col = "E"
                    Case "Vendor"
                        Col = "D"
                    Case "Terminated"
                        Col = "B"
                    Case "Excessive"
                        Col = "F"
                    Case Else
                        Col = "F"
                    End Select
                    
                    'Export value to oSheet
                    oSheet.Range(Col & oSheet.Cells(oSheet.Rows.Count, Col).End(xlUp).Offset(1).Row) = RTval
                    'Autofit for printable report
                    oSheet.Range(Col & oSheet.Cells(oSheet.Rows.Count, Col).End(xlUp).Offset(-1).Row).EntireColumn.AutoFit
                    
                Set C = .FindNext(C)
                Loop While Not C Is Nothing And C.Address <> firstAddress
            End If
                
        End With
 

Some videos you may like

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,219
Office Version
  1. 365
Platform
  1. Windows
I don't see anything in that code that wouldn't work, or would be different, in 2010.

There is one thing though - you have no worksheet reference here.
Code:
Expt = Cells(1, Tval.Column).Value
Try adding a reference to the relevant worksheet.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,910
Messages
5,598,813
Members
414,260
Latest member
joishe

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top