Solved

Excel Userform Initialize

Posted on 2015-01-20
5
166 Views
Last Modified: 2015-01-20
The attached spreadsheet has a Userform that allows the User to scroll through the rows of data in the spreadsheet.

Trying to figure out how to have the user double click in a "Sub-System" cell (Column C) and have the Userform open to that row data. Currently the Userform opens to the first record, and the user has to scroll through rows to reach the row in question.
Tracker-Workbook.xlsm
0
Comment
Question by:DougDodge
  • 3
  • 2
5 Comments
 
LVL 11

Expert Comment

by:Wilder1626
ID: 40560705
An example could be like below:

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

Dim Lastrow As Integer
Lastrow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row

Set Rng = Range("C6:C" & Lastrow)

If Not Intersect(Target, Rng) Is Nothing Then SubSystemDetail.Show

End Sub

Open in new window



If you want to be able to type in the cell with the Form open also, you use VbModeless:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, 

Dim Lastrow As Integer
Lastrow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row

Set Rng = Range("C1:C" & Lastrow)

If Not Intersect(Target, Rng) Is Nothing Then SubSystemDetail.Show VbModeless
End Sub

Open in new window

0
 

Author Comment

by:DougDodge
ID: 40560766
Double click opens the Userform, but it does not open it to the item that was double clicked on, it just opens the Userform.
0
 
LVL 11

Accepted Solution

by:
Wilder1626 earned 500 total points
ID: 40560851
If you want to see a value from a cell in the userform, you can do this. example
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)

SubSystemDetail.txtSubSystem = Cells(Application.ActiveCell.Row, 3).Value
    SubSystemDetail.Show

End Sub

Open in new window


That would enter the value from the C column Cell into the txtSubSystem  textbox

You can put has many textbox as you needs
Ex:
SubSystemDetail.TexBox1= Cells(Application.ActiveCell.Row, 3).Value

SubSystemDetail.TexBox2= Cells(Application.ActiveCell.Row, 4).Value

Open in new window

0
 

Author Closing Comment

by:DougDodge
ID: 40560963
Works like a charm.....

Thanks.....
0
 
LVL 11

Expert Comment

by:Wilder1626
ID: 40560973
i'm glad i was able to help.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

This article describes how to use the Send to Mail Recipient command. The instructions apply generally to Office 2007 and later versions, but Microsoft® Word 2013 was used for the specific steps and figures.  What is Send to Mail Recipient? Send…
Today companies are subjected to more-and-more data, and it won't stop any time soon.  But there are obvious opportunities for reducing data, particularly data duplicated among companies.
The viewer will learn how to edit the master slide. They will also learn how to combine multiple themes into one master slide to use them in their presentation.
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now