schnabs
Technical User
- Jan 21, 2009
- 50
Hello,
I have a workbook with two sheets. I am trying to use VB to make sure the totals on each are equal, as they should be. This is my code thus far.
Private Sub Compare_Click() Handles compare.Click
Dim oxl As Microsoft.Office.Interop.Excel.Application
Dim oxlbook As Microsoft.Office.Interop.Excel.Workbook
Dim path As String
path = Dir("Z:\2009 Combined Delinquencies\" & "0" & Month(Now) & " " & MonthName(Month(Now)) & "\")
oxl = New Microsoft.Office.Interop.Excel.Application
oxl.DisplayAlerts = False
oxl.Visible = True
Do While path <> ""
oxlbook = oxl.Workbooks.Open("Z:\2009 Combined Delinquencies\" & "0" & Month(Now) & " " & MonthName(Month(Now)) & "\" + path)
If oxlbook.Worksheets(2).Range("A65536").End("-4162").value = oxlbook.Worksheets(1).cells("B:B").large.value Then
Else
MsgBox("Fix")
End If
Loop
End Sub
My problem is coming from obtaining the second value, where I tried using large. There is text beneath the value, which prevents me from using the endxlup, but it is the only number in column B. I thought if I use the max, or large, function, it would work. Any ideas or thought??
Thanks.
I have a workbook with two sheets. I am trying to use VB to make sure the totals on each are equal, as they should be. This is my code thus far.
Private Sub Compare_Click() Handles compare.Click
Dim oxl As Microsoft.Office.Interop.Excel.Application
Dim oxlbook As Microsoft.Office.Interop.Excel.Workbook
Dim path As String
path = Dir("Z:\2009 Combined Delinquencies\" & "0" & Month(Now) & " " & MonthName(Month(Now)) & "\")
oxl = New Microsoft.Office.Interop.Excel.Application
oxl.DisplayAlerts = False
oxl.Visible = True
Do While path <> ""
oxlbook = oxl.Workbooks.Open("Z:\2009 Combined Delinquencies\" & "0" & Month(Now) & " " & MonthName(Month(Now)) & "\" + path)
If oxlbook.Worksheets(2).Range("A65536").End("-4162").value = oxlbook.Worksheets(1).cells("B:B").large.value Then
Else
MsgBox("Fix")
End If
Loop
End Sub
My problem is coming from obtaining the second value, where I tried using large. There is text beneath the value, which prevents me from using the endxlup, but it is the only number in column B. I thought if I use the max, or large, function, it would work. Any ideas or thought??
Thanks.