View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Ron Rosenfeld[_2_] Ron Rosenfeld[_2_] is offline
external usenet poster
 
Posts: 1,045
Default Excel 2007 - How to get cell referrences from dates in combobox

On Mon, 03 Oct 2011 13:01:16 -0700, Wee Willie Winkie wrote:


Excel (and VBA) can convert many text values that look like dates into the actual date.

What, exactly, is your combobox returning?

Is it a text value that looks like a date string? Or is it a text value that looks like a serial number?

Either can be converted to an actual date.


It is a text value that looks like a serial number.


I assume it is some five digit number, like 41027. That being the case, merely perform some mathematical operation on it to convert it to the serial number of the date.

For example, if your dates are in A1:A10, and your "linked cell" to the combo box is D4, then
=match(--d4,a1:a10,0) will return the row number containing the relevant date.



The second question is, how do I get a range from the Start and End dates that I can use in a
function?


There are many ways based on the above method, but exactly how depends on the details of your worksheet.

Basically you use the match function to find the relevant rows in the array, and then return a limited array based on that. Again, the precise method depends on information not available to me.