C
cereldine
Hi, i have a piece of code that is basically a means for users to copy
raw data out of external spreadsheets into another spreadsheet for
analysis and manipulation.
The raw data has a column on left that declares year and quarter in
format of 2005Q4. The user is faced with an inputbox that prompts them
for the date to copy data until. If they make a mistake e.g 200Q4,
200404 2005Q5 then the code is going to break. I would therfore like
some validation on the input box that verifys that we have a date in
the correct format that can be searched for.
Something like
sYear = Application.InputBox("Which Year/Quarter should data be
returned until? (In the format of 2006Q4)?", "Select Date", "2005Q4")
if syear = integer,integer,integer,integer,char,integer then
elseif syear = "" then
""No value"
end sub
end if
if left(syear,4) > 1990 and < 2010 then
else
exit sub
end if
if right(syear,1) in <> 1 or 2 or 3 or 4
exit sub
end if
Is this along the right lines or am i taking a very long way round?
raw data out of external spreadsheets into another spreadsheet for
analysis and manipulation.
The raw data has a column on left that declares year and quarter in
format of 2005Q4. The user is faced with an inputbox that prompts them
for the date to copy data until. If they make a mistake e.g 200Q4,
200404 2005Q5 then the code is going to break. I would therfore like
some validation on the input box that verifys that we have a date in
the correct format that can be searched for.
Something like
sYear = Application.InputBox("Which Year/Quarter should data be
returned until? (In the format of 2006Q4)?", "Select Date", "2005Q4")
if syear = integer,integer,integer,integer,char,integer then
elseif syear = "" then
""No value"
end sub
end if
if left(syear,4) > 1990 and < 2010 then
else
exit sub
end if
if right(syear,1) in <> 1 or 2 or 3 or 4
exit sub
end if
Is this along the right lines or am i taking a very long way round?