When my code gets to the activecell.value = dRate it just ends. Anyone know why this is happening? I need it to hit the activecell.offset(1,0).select for the loop to work!
Sub GetRates(sheetname)
Dim sCCY As String
Dim sDate As String
Dim dRate As Double
Dim iRow As Integer
Dim iColumn As Integer
Dim wksRates As Worksheet
Dim wksCustody As Worksheet
Dim iRow2 As Integer
Dim iColumn2 As Integer
Dim iFinalColumn As Integer
Dim iFinalRow As Integer
Dim rCurrentCell As Range
iRow = 3
iColumn = 7
Set wksRates = Application.Worksheets(sheetname)
Set wksCustody = Application.Worksheets("Custody Analysis")
Do Until ActiveCell.Offset(1, -1).Value = 0
sCCY = Cells(iRow, iColumn).Value
sDate = Cells(iRow, 2).Value
wksRates.Activate
iRow2 = 1
iColumn2 = 3
iFinalColumn = 0
iFinalRow = 0
Do Until Cells(iRow2, iColumn2).Value = sCCY
iColumn2 = iColumn2 + 1
Loop
iFinalColumn = iColumn2
iRow2 = 1
iColumn2 = 3
Do Until Cells(iRow2, iColumn2).Value = sDate
iRow2 = iRow2 + 1
Loop
iFinalRow = iRow2
On Error GoTo x
dRate = Cells(iFinalRow, iFinalColumn).Value
wksCustody.Activate
ActiveCell.Value = dRate - it just exits out here for some reason. Can't figure it out!
ActiveCell.Offset(1, 0).Select
x:
Loop
Sub GetRates(sheetname)
Dim sCCY As String
Dim sDate As String
Dim dRate As Double
Dim iRow As Integer
Dim iColumn As Integer
Dim wksRates As Worksheet
Dim wksCustody As Worksheet
Dim iRow2 As Integer
Dim iColumn2 As Integer
Dim iFinalColumn As Integer
Dim iFinalRow As Integer
Dim rCurrentCell As Range
iRow = 3
iColumn = 7
Set wksRates = Application.Worksheets(sheetname)
Set wksCustody = Application.Worksheets("Custody Analysis")
Do Until ActiveCell.Offset(1, -1).Value = 0
sCCY = Cells(iRow, iColumn).Value
sDate = Cells(iRow, 2).Value
wksRates.Activate
iRow2 = 1
iColumn2 = 3
iFinalColumn = 0
iFinalRow = 0
Do Until Cells(iRow2, iColumn2).Value = sCCY
iColumn2 = iColumn2 + 1
Loop
iFinalColumn = iColumn2
iRow2 = 1
iColumn2 = 3
Do Until Cells(iRow2, iColumn2).Value = sDate
iRow2 = iRow2 + 1
Loop
iFinalRow = iRow2
On Error GoTo x
dRate = Cells(iFinalRow, iFinalColumn).Value
wksCustody.Activate
ActiveCell.Value = dRate - it just exits out here for some reason. Can't figure it out!
ActiveCell.Offset(1, 0).Select
x:
Loop