Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default VBA Search Date Range and Populate Spreadsheet Cells

Hello, I'm new to this forum, but am desperately seeking some Excel
VBA help...

What I have is a spreadsheet that autopopulates several fields from a
SQL Query Macro into specific cells on the sheet. The fields contain
Date, Item#, Item Name, etc.

What I have done was create a UserForm that requests that the user
input a Start Date and an End Date in its' textboxes...and would
ultimately like this UserForm to search the Date field of the
spreadsheet for the date range provided by the user and pull those
records in the spreadsheet by re-populating the starting cell (where
the SQL Query begins upon opening the spreadsheet).

The problem is...I really have no idea where to begin with the
UserForm code, or if this is even possible. Can I use a UserForm to
pull and populate the sheet, or do I need to add onto the SQL Query
Macro to request that the user input the desired date ranges after the
Query runs upon opening the sheet?

Hopefully this all makes sense, I have been grinding through a lot of
articles but cannot find something specific to my needs.

If you need more information, I can provide as much as I have.

Thank you in advance for all of your help!

~Diana Peterson~

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default VBA Search Date Range and Populate Spreadsheet Cells

Use the workbook_Open event (found in the ThisWorkbook module) to show the
userform and get the dates. Then build the SQL querystring to incorporate
the dates provided by the user, then execute the query using this string.


http://www.cpearson.com/excel/events.htm

if you are using a querytable then look he
http://nickhodge.co.uk/gui/datamenu/...taexamples.htm

http://www.dicks-clicks.com/excel/Ex...htm#Parameters

--
Regards,
Tom Ogilvy


"Diana" wrote:

Hello, I'm new to this forum, but am desperately seeking some Excel
VBA help...

What I have is a spreadsheet that autopopulates several fields from a
SQL Query Macro into specific cells on the sheet. The fields contain
Date, Item#, Item Name, etc.

What I have done was create a UserForm that requests that the user
input a Start Date and an End Date in its' textboxes...and would
ultimately like this UserForm to search the Date field of the
spreadsheet for the date range provided by the user and pull those
records in the spreadsheet by re-populating the starting cell (where
the SQL Query begins upon opening the spreadsheet).

The problem is...I really have no idea where to begin with the
UserForm code, or if this is even possible. Can I use a UserForm to
pull and populate the sheet, or do I need to add onto the SQL Query
Macro to request that the user input the desired date ranges after the
Query runs upon opening the sheet?

Hopefully this all makes sense, I have been grinding through a lot of
articles but cannot find something specific to my needs.

If you need more information, I can provide as much as I have.

Thank you in advance for all of your help!

~Diana Peterson~


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 20
Default VBA Search Date Range and Populate Spreadsheet Cells

On Mar 14, 2:00 pm, Tom Ogilvy
wrote:
Use the workbook_Open event (found in the ThisWorkbook module) to show the
userform and get the dates. Then build the SQL querystring to incorporate
the dates provided by the user, then execute the query using this string.

http://www.cpearson.com/excel/events.htm

if you are using a querytable then look hehttp://nickhodge.co.uk/gui/datamenu/...aldataexamples...

http://www.dicks-clicks.com/excel/Ex...htm#Parameters

--
Regards,
Tom Ogilvy



"Diana" wrote:
Hello, I'm new to this forum, but am desperately seeking some Excel
VBA help...


What I have is a spreadsheet that autopopulates several fields from a
SQL Query Macro into specific cells on the sheet. The fields contain
Date, Item#, Item Name, etc.


What I have done was create a UserForm that requests that the user
input a Start Date and an End Date in its' textboxes...and would
ultimately like this UserForm to search the Date field of the
spreadsheet for the date range provided by the user and pull those
records in the spreadsheet by re-populating the starting cell (where
the SQL Query begins upon opening the spreadsheet).


The problem is...I really have no idea where to begin with the
UserForm code, or if this is even possible. Can I use a UserForm to
pull and populate the sheet, or do I need to add onto the SQL Query
Macro to request that the user input the desired date ranges after the
Query runs upon opening the sheet?


Hopefully this all makes sense, I have been grinding through a lot of
articles but cannot find something specific to my needs.


If you need more information, I can provide as much as I have.


Thank you in advance for all of your help!


~Diana Peterson~- Hide quoted text -


- Show quoted text -


Thank you so much Tom, you have made my life much easier by providing
me the tools to get ahead. I really appreciate your help with pointing
me i the right direction!

I've noticed that you have been the main answerer to many of the
questions posed on this website. Perhaps someday we will gather all of
your personal help and make a website dedicated to your expertise. =P
Providing you would accept such a demand of your intelligence!!

Hehe...thanks again!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default VBA Search Date Range and Populate Spreadsheet Cells

There are too many great contributors here - fortunately their wisdom is
archived on Google Groups!

--
Regards,
Tom Ogilvy

"Diana" wrote in message
oups.com...
On Mar 14, 2:00 pm, Tom Ogilvy
wrote:
Use the workbook_Open event (found in the ThisWorkbook module) to show
the
userform and get the dates. Then build the SQL querystring to
incorporate
the dates provided by the user, then execute the query using this string.

http://www.cpearson.com/excel/events.htm

if you are using a querytable then look
hehttp://nickhodge.co.uk/gui/datamenu/...aldataexamples...

http://www.dicks-clicks.com/excel/Ex...htm#Parameters

--
Regards,
Tom Ogilvy



"Diana" wrote:
Hello, I'm new to this forum, but am desperately seeking some Excel
VBA help...


What I have is a spreadsheet that autopopulates several fields from a
SQL Query Macro into specific cells on the sheet. The fields contain
Date, Item#, Item Name, etc.


What I have done was create a UserForm that requests that the user
input a Start Date and an End Date in its' textboxes...and would
ultimately like this UserForm to search the Date field of the
spreadsheet for the date range provided by the user and pull those
records in the spreadsheet by re-populating the starting cell (where
the SQL Query begins upon opening the spreadsheet).


The problem is...I really have no idea where to begin with the
UserForm code, or if this is even possible. Can I use a UserForm to
pull and populate the sheet, or do I need to add onto the SQL Query
Macro to request that the user input the desired date ranges after the
Query runs upon opening the sheet?


Hopefully this all makes sense, I have been grinding through a lot of
articles but cannot find something specific to my needs.


If you need more information, I can provide as much as I have.


Thank you in advance for all of your help!


~Diana Peterson~- Hide quoted text -


- Show quoted text -


Thank you so much Tom, you have made my life much easier by providing
me the tools to get ahead. I really appreciate your help with pointing
me i the right direction!

I've noticed that you have been the main answerer to many of the
questions posed on this website. Perhaps someday we will gather all of
your personal help and make a website dedicated to your expertise. =P
Providing you would accept such a demand of your intelligence!!

Hehe...thanks again!



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Populate worksheet with data that meets date range criteria P0llyW0G Excel Worksheet Functions 3 September 28th 08 10:01 PM
Search multiple cells with conditions, sum and auto populate! Desperately seeking hammer !! Excel Worksheet Functions 3 August 18th 07 12:20 AM
if date=then populate cells inkrisitive Excel Programming 0 June 26th 06 09:22 PM
Populate a range of cells from a function 4eyed Excel Programming 2 June 1st 05 11:17 PM
Range of Cells to populate in a text box on a userform BenjiHarshbarge Excel Programming 1 November 4th 03 10:09 PM


All times are GMT +1. The time now is 01:46 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"