I'm having a problem with the following function. For some reason, the function returns before the first MsgBox call. It succesfully deletes the column, but it exits right after. Any help?
Sub main()
Dim numRates As Integer
Dim numDates As Integer
Const RateOffset As Integer = 5
Const DateOffset As Integer = 3
Dim columns As Range
Dim ratesRange As Range
numRates = Range("IntTimeSeriesRates").Value
numDates = Range("IntTimeSeriesDates").Value
Set columns = Range(Cells(RateOffset, DateOffset + numDates - 1), Cells(RateOffset + numDates, DateOffset + numDates - 1))
columns.Delete
MsgBox "Hello1"
Set columns = Range(Cells(RateOffset, DateOffset), Cells(RateOffset + numRates, DateOffset))
columns.Insert shift:=xlToRight
MsgBox "Hello2"
End Sub
Bookmarks