macro for pop up choices

HappyChappy

Active Member
Joined
Jan 26, 2013
Messages
378
Office Version
  1. 2019
  2. 2010
  3. 2007
Platform
  1. Windows
Hi dont know if its possible but i have a file that needs to have data sheets pasted into it. the data is held further down the file stucture which changes over time. for example main folder, year folder, month folder, week folder
inside the week folder is 7 spreasheets all dated for example debrief01.01.2020 to debrief07.01.2020 i need to open each one and copy the first sheet into my main folder spreadsheet. what i would like is a marco that prompts me for the file stucture by popping up a box to ask which year, then another which month, then which week. once i have told it where the files are to grab the data and paste them into the main spreadsheet.
Hope this makes sense. regards
 

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.
This will prompt you for the year, month and day

VBA Code:
Dim YearID, MonthID, DayID As String

Sub Prompts()
YearID = ""
MonthID = ""
DayID = ""

Do While YearID = ""
    YearID = InputBox("Which year[yyyy]?", ThisWorkbook.Name)
    If Len(YearID) <> 4 Then
        MsgBox "Year must be 4 characters [yyyy]", vbCritical, ThisWorkbook.Name
        YearID = ""
    End If
Loop
Do While MonthID = ""
    MonthID = InputBox("Which month[mm]?", ThisWorkbook.Name)
    If Len(MonthID) <> 2 Then
        MsgBox "Month must be 2 characters [mm]", vbCritical, ThisWorkbook.Name
        MonthID = ""
    End If
Loop
Do While DayID = ""
    DayID = InputBox("Which day[dd]?", ThisWorkbook.Name)
    If Len(DayID) <> 2 Then
        MsgBox "Day must be 2 characters [dd]", vbCritical, ThisWorkbook.Name
        DayID = ""
    End If
Loop

End Sub
 
Upvote 0

Forum statistics

Threads
1,214,430
Messages
6,119,442
Members
448,898
Latest member
drewmorgan128

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