LaBamba
09-18-2014, 09:34 AM
Hey guys;
Can you please take a look at the below code...i am really puzzled as to why i get this error on the Set rPS and Set rGS but the other ranges work just fine.
Its exactly the same code except its finding something else.
Let me know your thoughts.
Sub testcalc()
Dim wbCustomerFile As Workbook
Dim wbMaster As Workbook
Dim shCommands As Worksheet
Dim lRankCol As Long
Dim lNRQtyCol As Long
Dim lRebateQtyCol As Long
Dim lPricingCol As Long
Dim i As Long
Dim lRow As Long
Dim rPS As Range
Dim rGS As Range
Dim rNrTotal As Range
Dim rCombined As Range
Dim rRbtTotal As Range
Dim dNonTotal As Double
Dim dRbtTotal As Double
Dim dCombinedTotal As Double
Application.ScreenUpdating = False
On Error GoTo errorHandler
Set wbMaster = ThisWorkbook
Set shCommands = wbMaster.Sheets(g_strCOMMAND_SHEET_NAME)
Set rPS = wbMaster.Sheets(1).Rows(1).Cells.Find(What:="PS", lookat:=xlWhole, Searchorder:=xlByColumns, MatchCase:=True).End(xlUp).End(xlDown).Offset(1, 0)
Set rGS = wbMaster.Sheets(1).Rows(1).Cells.Find(What:="GS", lookat:=xlWhole, Searchorder:=xlByColumns, MatchCase:=True).End(xlUp).End(xlDown).Offset(1, 0)
Set rNrTotal = wbMaster.Sheets(1).Rows(1).Cells.Find(What:="Rank 1", lookat:=xlWhole, Searchorder:=xlByColumns, MatchCase:=True).End(xlUp).End(xlDown).Offset(1, 0)
Set rCombined = wbMaster.Sheets(1).Rows(1).Cells.Find(What:="Rank 1/1R", lookat:=xlWhole, Searchorder:=xlByColumns, MatchCase:=True).End(xlUp).End(xlDown).Offset(1, 0)
Set rRbtTotal = wbMaster.Sheets(1).Rows(1).Cells.Find(What:="Rank 1R", lookat:=xlWhole, Searchorder:=xlByColumns, MatchCase:=True).End(xlUp).End(xlDown).Offset(1, 0)
Thanks,
Can you please take a look at the below code...i am really puzzled as to why i get this error on the Set rPS and Set rGS but the other ranges work just fine.
Its exactly the same code except its finding something else.
Let me know your thoughts.
Sub testcalc()
Dim wbCustomerFile As Workbook
Dim wbMaster As Workbook
Dim shCommands As Worksheet
Dim lRankCol As Long
Dim lNRQtyCol As Long
Dim lRebateQtyCol As Long
Dim lPricingCol As Long
Dim i As Long
Dim lRow As Long
Dim rPS As Range
Dim rGS As Range
Dim rNrTotal As Range
Dim rCombined As Range
Dim rRbtTotal As Range
Dim dNonTotal As Double
Dim dRbtTotal As Double
Dim dCombinedTotal As Double
Application.ScreenUpdating = False
On Error GoTo errorHandler
Set wbMaster = ThisWorkbook
Set shCommands = wbMaster.Sheets(g_strCOMMAND_SHEET_NAME)
Set rPS = wbMaster.Sheets(1).Rows(1).Cells.Find(What:="PS", lookat:=xlWhole, Searchorder:=xlByColumns, MatchCase:=True).End(xlUp).End(xlDown).Offset(1, 0)
Set rGS = wbMaster.Sheets(1).Rows(1).Cells.Find(What:="GS", lookat:=xlWhole, Searchorder:=xlByColumns, MatchCase:=True).End(xlUp).End(xlDown).Offset(1, 0)
Set rNrTotal = wbMaster.Sheets(1).Rows(1).Cells.Find(What:="Rank 1", lookat:=xlWhole, Searchorder:=xlByColumns, MatchCase:=True).End(xlUp).End(xlDown).Offset(1, 0)
Set rCombined = wbMaster.Sheets(1).Rows(1).Cells.Find(What:="Rank 1/1R", lookat:=xlWhole, Searchorder:=xlByColumns, MatchCase:=True).End(xlUp).End(xlDown).Offset(1, 0)
Set rRbtTotal = wbMaster.Sheets(1).Rows(1).Cells.Find(What:="Rank 1R", lookat:=xlWhole, Searchorder:=xlByColumns, MatchCase:=True).End(xlUp).End(xlDown).Offset(1, 0)
Thanks,