Compile error: ByRef argument type mismatch

USAMax

Well-known Member
Joined
May 31, 2006
Messages
843
Office Version
  1. 365
Platform
  1. Windows
I have had this problem before but never in something so simple. In this case it is looking at the variable DataRowCount that is defined as an Integer in the function and assigned the value of 1 in the subroutine. In the subroutine I get the Compile error and it highlights the variable. Can someone tell me why?

Function UpdateWeekDetailsSheet(ProjectName As String, FirstRowOfData As Integer, DataRowCount As Integer, FirstDateColumn As Integer)
Sheets(WeekDetails).Select
Cells.Find(What:=ProjectName, After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate 'Search for the Project Name
End Function



Sub TestCall()
Dim CurRow As Integer 'Current Row is used when searching rows
DataRowCount = 1
CurRow = ActiveCell.Row
Do While Cells(ActiveCell.Row + 1, 2) <> ""
DataRowCount = DataRowCount + 1
Loop
Call UpdateWeekDetailsSheet(Cells(ActiveCell.Row - 1, 1), ActiveCell.Row, DataRowCount, ActiveCell.Column)
End Sub
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.

Forum statistics

Threads
1,215,334
Messages
6,124,323
Members
449,154
Latest member
pollardxlsm

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top