Yiota has attended:
Access Introduction course
Access Intermediate course
Excel VBA Introduction course
Excel VBA Intermediate course
Creating a report template through Excel VBA Forms
Hello,
I want to create a report so users can select what fields they want to extract data, similar to Pivot but more user friendly.
Users can select which fields they want and it will run.
Data is also in different tabs, can this be done through 'Forms'?
Regards
Yiota
RE: Creating a report template through Excel VBA Forms
Hi Yiota,
Yes, this is very possible.
You can give your users a user form and use options, checkboxes or multiselect list boxes to select what they want to be included in their report.
Once the user presses OK you can use IF THEN ELSE or Select Case to determine which actions match those selections.
If you can express the logic then you can create the report using a User Form to choose what is included.
Are you creating the report from scratch? Where is your original data? Are you selecting the data and copying to an empty sheet?
Please let me know if you need further help. I suspect that building the user form is the easier part of this problem.
thanks
Claire
RE: Creating a report template through Excel VBA Forms
Hi Claire
Thanks for this, can you please just give me the code. For example, data is in column A and I want to link the command / filter to that column and return the data, selected range from form, like a date range.
That's where I'm getting confused.
Thank you!
Yiota
RE: Creating a report template through Excel VBA Forms
Hi Yiota,
You're going to need something like this on your OK button:
======
Private Sub cmdOK_Click()
If optFirst = True Then
Range(Range("A1"), Selection.End(xlDown)).Copy Range("H1")
End If
Unload UserForm1
End Sub
======
This is working on the assumption that the selection related to optFirst is found in A1 and you'd select all the way to the bottom of that range. Then you copy it to another location, H1 in the example.
As I don't know what your spreadsheet looks like I can't be more specific.
Hope this helps.
Claire
Will be marked as resolved in 5 days
Notice: This is an automated message. Due to inactivity, this forum post will be marked as 'resolved' if there are no further responses in the next 5 days.