I am close to getting this code to work but I get the most ridiculous sporadic errors and am getting frustrated. I have no idea why it freezes, sometimes it will give me errors like "End Sub", or Next x (random numbers), then the y=y + 31 is an error its never the same, then all of a sudden the code works find and does exactly what it is programed to do???
Anybody have any ideas. I am assuming I am missing something pretty important.
Private Sub cmdUpdate_Click()
Application.ScreenUpdating = False
Dim NumofTaxYr As Double
Dim TaxCalcSht As Worksheet
Dim y As Double
' Dim z As Double
Set TaxCalcSht = Worksheets("Tax Calc")
TaxCalcSht.Activate
NumofTaxYr = Val(cmbTaxYrEnd.Value) - Val(cmbTaxYrStart.Value) + 1
y = 10
' z = 0
For x = 1 To NumofTaxYr
TaxCalcSht.Rows(y & ":" & y + 29).Select
Selection.Copy
y = y + 31
' z = z + 1
TaxCalcSht.Rows(y & ":" & y).Select
ActiveSheet.Paste
' Cells(y + 1, 2).Value = cmbTaxYrStart.Value + z
Next x
TaxCalcSht.Range("A1").Select
Application.CutCopyMode = False
Unload Me
Application.ScreenUpdating = True
End Sub
Anybody have any ideas. I am assuming I am missing something pretty important.
Private Sub cmdUpdate_Click()
Application.ScreenUpdating = False
Dim NumofTaxYr As Double
Dim TaxCalcSht As Worksheet
Dim y As Double
' Dim z As Double
Set TaxCalcSht = Worksheets("Tax Calc")
TaxCalcSht.Activate
NumofTaxYr = Val(cmbTaxYrEnd.Value) - Val(cmbTaxYrStart.Value) + 1
y = 10
' z = 0
For x = 1 To NumofTaxYr
TaxCalcSht.Rows(y & ":" & y + 29).Select
Selection.Copy
y = y + 31
' z = z + 1
TaxCalcSht.Rows(y & ":" & y).Select
ActiveSheet.Paste
' Cells(y + 1, 2).Value = cmbTaxYrStart.Value + z
Next x
TaxCalcSht.Range("A1").Select
Application.CutCopyMode = False
Unload Me
Application.ScreenUpdating = True
End Sub