I have a problem here and would like to seek help. Thank you in advance. As it's a long list of vba codes, I thought I would just illustrate the portion that I have problem with.
S1: Definition Sheet
S3: Input/Raw Data sheet
S4: Display sheet (in the format required)
I have a sheet with many companies and their relevant financial dates that I would like to display on another sheet (S4). All the inputs for the financial data are available in S3.
I have a definition sheet(S1) with the list of the companies that I have and for each company, I have identified the financials that I need.
Problem: I get an error saying there's a "Type Mismatch" and I have no idea what's wrong. If anyone could help, that would be very much appreciated. Thanks.
[TABLE="class: grid, width: 500"]
Company ID
[/td]Company Name
[/td]Relevant Financial Year 1
[/td]Relevant Financial Year 2
[/td]Relevant Financial Year 3
[/td]1121
[/td]AA
[/td]Dec-12
[/td]Dec-13
[/td]Dec-14
[/td]2231
[/td]AB
[/td]Dec-14
[/td]Dec-15
[/td]Dec-16
[/td]3567
[/td]AC
[/td]Jan-12
[/td]Jan-13
[/td]Jan-15
[/td]4901
[/td]AD
[/td]Feb-14
[/td]Feb-15
[/td]Feb-16
[/td]5
[/td]AE
[/td]Jan-12
[/td]Jan-13
[/td]Jun-13
[/td]6
[/td]AF
[/td]7
[/td]AG
[/td]
[/TABLE]
Dim rRange As Range
Dim ComID As Integer
Dim S1 As Worksheet
Set S1 = ActiveWorkbook.Worksheets("Def_Sheet")
ComID = S3.Cells(I, Col_CID).Value
S1.Select
Set rRange = S1.Range("U4", Range("U4").End(xlDown))
'save the first relevant date as YR(1) in the date format as per the table above
rRange.Find(What:=ComID, After:="U4", LookIn:=xlValues, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False).Offset(0, 2) = YR(1)
rRange.Find(What:=ComID, After:="U4", LookIn:=xlValues, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False).Offset(0, 3) = YR(2)
rRange.Find(What:=ComID, After:="U4", LookIn:=xlValues, LookAt:= _
xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False).Offset(0, 4) = YR(3)
Num_Year=3
For J = 1 To Num_Year
If S3.Cells(I, Col_CID + 3) = YR(J) Then
'display FYE
S4.Cells(Row_Curr + 21, Col_Curr + J - 1) = S3.Cells(I, Col_CID + 4)
Display More