Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Selecting cells in excel

Status
Not open for further replies.

funkmonsteruk

IS-IT--Management
Feb 8, 2002
210
GB
I have a spreadsheet in which i need the user to be able to enter a value into a text box (This will be in the form of a date and time) which corresponds to a cell on a spreedsheet, then select a value from a listbox (this will be a length of time in hours) which should correspond to the number of cells below the initial selection (think this might be the ActiveCell).

I then need the selection to change colour and display text. The changing colour and displaying text side is pretty much in hand, but coding the selection procedure is causing me a lot of problems, does anyone have a solution?
 
Lunchtime specials all round

If I understood, this should get you on the way

Code:
Sub standard()
Dim lRow_1 As Long
Dim lRow_2 As Long
lRow_1 = ActiveSheet.Cells.Find(what:=4).Row ' what:=textbox1.value
lRow_2 = lRow_1 + 10 'your listbox value
Range(Cells(lRow_1, 1), Cells(lRow_2, 1)).Select 'don't select just change colour

End Sub

;-) If a man says something and there are no women there to hear him, is he still wrong?
 
A little comment here:
Loomah - your code would work on anything but dates
Try using it with dates - it's a nightmare
Have tried finding text in values, value in values, value in formulae - nothing works :(

TRy this:
Record yourself searching for (and finding) a date in a spreadsheet
Stop recording
Play the macro that has just been recorded.....error no cells were found that match
??????????????????????????????/

The only way I've got round this is to have a corresponding list of date values next to the dates and search thru them using the datevalue all the way thru. If anyone has a better way of searchin for dates in code, I for one would love to know of it Rgds
~Geoff~
 
xlbo
Quite so! I think I have mentioned somewhere before that I HATE DATES, that said I just wasn't thinking about it at the time as I'm down to doing this at lunchtimes now. If time permits................

How ironic then that I named the routine the way I did?!!? Alanis would've loved it.

Happy Friday
Who are Bolton?
;-) If a man says something and there are no women there to hear him, is he still wrong?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top