View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Robert Flanagan Robert Flanagan is offline
external usenet poster
 
Posts: 71
Default Select column that matches a value entered in a User Form TextBox

I assume you meant "6" inthe day row, not column. Assuming I'm right, and
few other assumptions, then

dim C as integer
C = userform1.textbox1.text
if c = 0 then
msgbox "enter a number"
exit sub
end if
'assuming your entries are in row 1, and start in column B, since column A
is likely to be a title column, then:
Cells(1,C+1).select

Robert Flanagan
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel


"Gwyzor" wrote in message
...
I am building an Excel 2007 User Form in VB. I want my users to be able to
type the day of month (i.e. 6 for the 6th of the month) and have code that
automatically selects the column that is set up for that date to be used.
Each column has the day of the month as the top field of the column.
Therefore, if they type '6', I want to select the equal value, '6' in the
day
column, and use that column. Have tried several functions, and am not
coming
up with the correct code to accomplish this.