Help Please ... LngRow to = Cell b3

inkbird1

Board Regular
Joined
Apr 21, 2020
Messages
51
HI all I have the following code where I want 25/05/2020 to infact be whatever value (will be a date) in cell B3 of the worksheet its on


Private Sub Worksheet_Activate()
Dim arrIncidents As Variant
Dim arrActive As Variant
Dim lngRow As Long
Dim cnt As Long

arrIncidents = Sheets("Incidents").Range("A1").CurrentRegion.Value

ReDim arrActive(1 To 6, 1 To UBound(arrIncidents, 1))

For lngRow = 2 To UBound(arrIncidents, 1)

If arrIncidents(lngRow, 1) = "25/05/2020" Then
cnt = cnt + 1
arrActive(1, cnt) = arrIncidents(lngRow, 1)
arrActive(2, cnt) = arrIncidents(lngRow, 2)
arrActive(3, cnt) = arrIncidents(lngRow, 3)
arrActive(4, cnt) = arrIncidents(lngRow, 4)
arrActive(5, cnt) = arrIncidents(lngRow, 5)
arrActive(6, cnt) = arrIncidents(lngRow, 6)
End If

Next lngRow

ReDim Preserve arrActive(1 To 6, 1 To cnt)

With ListBox100
.ColumnCount = 6
.Column = arrActive
.ColumnWidths = "100,100,150,200,200,300"


End With

End Sub
 

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
If it's on the current sheet use
I
VBA Code:
f arrIncidents(lngRow, 1) = Range("B3").value Then
If it's on another sheet use
VBA Code:
If arrIncidents(lngRow, 1) = Sheets("your other sheetname").Range("B3").value Then
 
Upvote 0

Forum statistics

Threads
1,215,035
Messages
6,122,791
Members
449,095
Latest member
m_smith_solihull

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