Link to home
Start Free TrialLog in
Avatar of Cartillo
CartilloFlag for Malaysia

asked on

Display Data at Userform Based on Conditions

Hi Experts,

I would like to request Experts help to modify the attached script to display data from “Daily Tracking List” sheet at Userform 2 based on populated data at column B43 onwards at Chart 2 sheet. The data was copied from “Daily Tracking List” if  2 conditions “Module 1 - Sub InsertIssue()”:

 data with “Yes” at column I “Daily Tracking List” and referring to week of the month (week of the month based on cell at B41 – Chart sheet which is looking at column A “Daily Tracking List”).

The userform is activated when we double click cell at column B 43 and onward but not extracting the right data as per condition. Hope Experts will help me to  modify this script and able to display the right data  at Userform.



Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Dim rng As Range
Dim celle As Range

With Sheets("Chart2")
    Set rng = Range(.Cells(2, "B"), .Cells(.Rows.Count, "C"))
End With

If Not Intersect(rng, Target) Is Nothing Then
    On Error GoTo ende
    UserForm2.Show
Else
    On Error GoTo ende
    UserForm2.Hide
    Unload UserForm2
End If
ende:
End Sub

Open in new window

Chart-Userform.xls
Avatar of Eric Zwiekhorst
Eric Zwiekhorst
Flag of Netherlands image

Hi Cartillo,

as I can see where you went wrong is this:

You take the row number of the issue you doubleclick to look at the same row in Daily tracking.
These don't match.

What you should do is remember the row where is the first occurence that is in your issue list.
then you can find that row and all others by just taking the doubleclick row minus 43 and adding to the remembered row.
then you will find the correct data...


Kind regards

Eric
Avatar of Cartillo

ASKER

Hi Eric,

Please assist me, hope you can share with me the amended code.
ASKER CERTIFIED SOLUTION
Avatar of Eric Zwiekhorst
Eric Zwiekhorst
Flag of Netherlands image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi Eric,

Thank for the file. Only first row showing the right matched, the other following rows showing a wrong match. E.g. selection for TH9 (Line chart will display different chart plot based on spinner selection), first row matched with issue 3, but the 2nd to 4th rows are showing  different data in Userform.  
Oh, I was thinking the rows followed but apparently they don't
Then we have to make the variable StrtRow a array and remember for each row in the generated issue list the corresponding row in the details list...

Can you cope with that or do you need me to write code for you?


Kind regards

Eric
Hi Eric,

Hope you will consider create a variable StrtRow, please.
Code altered to array...
Chart-Userform.xls
Hi Eric,

Thanks a lot for the code. The userform always show the last data that was captured even though the row with status "No Issue". Is that possible the userform only active if the rows with content? if no issue activate boxMsgBox ("No incidents relative to this channel or time period")
Hope you'll consider this request.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi Eric,

Thanks a lot for giving me a superb solution
No problem,

Thanks for the points...

Eric
Hi Eric,

Hope you will consider this request, based on same workbook:

https://www.experts-exchange.com/questions/26949568/Add-filter-for-data-display-in-Userform.html