Hello. I am fairly new to VB programming, and find it rather more difficult than C. Appreciate whoever can help me.
I am making a template for a family owned engineering firm, which calculates winloads on specific products within the city of FT Lauderdale. Everything had been working until I tried to pass a variable to another sub. Here are the two subs:
This sub determines whether a new sheet needs to be created
and this sub creates the new sheet
When I compile the cursor stops and highlights the S in the second line and highlights in yellow the first line. It then gives the "COMPILE ERROR: TYPE MISMATCH" message box
I would be greatly debted to whoever can help me.
I am making a template for a family owned engineering firm, which calculates winloads on specific products within the city of FT Lauderdale. Everything had been working until I tried to pass a variable to another sub. Here are the two subs:
This sub determines whether a new sheet needs to be created
Code:
Sub CHART_START()
Dim CT, PNC, PN, CT3, C3, R3, NS, S, C As Integer
CT = 0
PN = Cells(5, 2)
C = 6
Do While CT <= PN
PNC = PNC + Cells(CT + 7, C)
COUNT = COUNT + 1
Loop
CT3 = 1
ROW3 = 11
COLUMN3 = 1
NS = 13
S = 5
Do While CT3 <= PNC
If CT3 > NS Then
Call NEW_SHEET(ByVal S)
S = S + 1
NS = NS + 13
End If
Sheets(S).Select
Cells(R, C) = CT3
CT3 = CT3 + 1
R = R + 2
Loop
End Sub
and this sub creates the new sheet
Code:
Sub NEW_SHEET(S As Integer)
Sheets("BLANK").Select
Sheets("BLANK").Copy After:=Sheets(S)
Sheets(S + 1).Select
Sheets(S + 1).Name = "CHART " & S - 5
End Sub
When I compile the cursor stops and highlights the S in the second line and highlights in yellow the first line. It then gives the "COMPILE ERROR: TYPE MISMATCH" message box
Code:
Sub CHART_START()
Call NEW_SHEET(ByVal S)
I would be greatly debted to whoever can help me.