Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default refer to a userform in a formula

I have a userform that collects information that needs to be referenced later
on in a procedure.
How would I reference the value of an option button or listbox, combobox
etc. in a formula/ if statement?
Any takers?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default refer to a userform in a formula

A procedure is not a formula, so your question is quite confusing.
The common ways are to have a procedure running while, or started from, the
userform while it's there, or to have the form write information to a
worksheet for later use.

HTH. Best wishes Harald

"TimT" skrev i melding
...
I have a userform that collects information that needs to be referenced

later
on in a procedure.
How would I reference the value of an option button or listbox, combobox
etc. in a formula/ if statement?
Any takers?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default refer to a userform in a formula

Sorry about that, my terminology is bad.
How can I store the results of the userform to cells in the workbook (a
hidden vlookup sheet). The user is collecting information that will be used
in formulas and in code.

"Harald Staff" wrote:

A procedure is not a formula, so your question is quite confusing.
The common ways are to have a procedure running while, or started from, the
userform while it's there, or to have the form write information to a
worksheet for later use.

HTH. Best wishes Harald

"TimT" skrev i melding
...
I have a userform that collects information that needs to be referenced

later
on in a procedure.
How would I reference the value of an option button or listbox, combobox
etc. in a formula/ if statement?
Any takers?




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default refer to a userform in a formula

Debra Dalgleish has a sample userform at:
http://www.contextures.com/xlUserForm01.html

That has code that writes to a worksheet.

TimT wrote:

I have a userform that collects information that needs to be referenced later
on in a procedure.
How would I reference the value of an option button or listbox, combobox
etc. in a formula/ if statement?
Any takers?


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default refer to a userform in a formula

Thanks Dave,
if I wanted to refer to a specific cell that I named would the syntax be
ws.range ("rangename')
or
ws.cells ("rangename")
or
ws.cells (a:2)

"Dave Peterson" wrote:

Debra Dalgleish has a sample userform at:
http://www.contextures.com/xlUserForm01.html

That has code that writes to a worksheet.

TimT wrote:

I have a userform that collects information that needs to be referenced later
on in a procedure.
How would I reference the value of an option button or listbox, combobox
etc. in a formula/ if statement?
Any takers?


--

Dave Peterson



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default refer to a userform in a formula

I'm having a tough time with this one. I'm missing something in my syntax

Private Sub Start_Click()

Dim ws As Worksheet
Set ws = Worksheets("vlookup")

'copy the data to the database
ws.Cells(1, 3).Value = frm_Data.TaxType.Value

it's not returning the value into the cell.
Taxtype is a listbox, is there a property that could be set wrong?

"Dave Peterson" wrote:

Debra Dalgleish has a sample userform at:
http://www.contextures.com/xlUserForm01.html

That has code that writes to a worksheet.

TimT wrote:

I have a userform that collects information that needs to be referenced later
on in a procedure.
How would I reference the value of an option button or listbox, combobox
etc. in a formula/ if statement?
Any takers?


--

Dave Peterson

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default refer to a userform in a formula

What kind of listbox is TaxType?

Does it support selecting multiple options--or can you only select one?

Your snippet of code looks ok to me.

Maybe an extra line:

msgbox frm_data.taxtype.value

would help show you the problem.

TimT wrote:

I'm having a tough time with this one. I'm missing something in my syntax

Private Sub Start_Click()

Dim ws As Worksheet
Set ws = Worksheets("vlookup")

'copy the data to the database
ws.Cells(1, 3).Value = frm_Data.TaxType.Value

it's not returning the value into the cell.
Taxtype is a listbox, is there a property that could be set wrong?

"Dave Peterson" wrote:

Debra Dalgleish has a sample userform at:
http://www.contextures.com/xlUserForm01.html

That has code that writes to a worksheet.

TimT wrote:

I have a userform that collects information that needs to be referenced later
on in a procedure.
How would I reference the value of an option button or listbox, combobox
etc. in a formula/ if statement?
Any takers?


--

Dave Peterson


--

Dave Peterson
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default refer to a userform in a formula

If the cell had a name:
ws.range("myName").value = ....

if you knew the row and column number of the cell:
ws.cells(row#,col#).value = ....





TimT wrote:

Thanks Dave,
if I wanted to refer to a specific cell that I named would the syntax be
ws.range ("rangename')
or
ws.cells ("rangename")
or
ws.cells (a:2)

"Dave Peterson" wrote:

Debra Dalgleish has a sample userform at:
http://www.contextures.com/xlUserForm01.html

That has code that writes to a worksheet.

TimT wrote:

I have a userform that collects information that needs to be referenced later
on in a procedure.
How would I reference the value of an option button or listbox, combobox
etc. in a formula/ if statement?
Any takers?


--

Dave Peterson


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Refer to Another Spreadsheet in a Formula DOUG Excel Worksheet Functions 4 April 20th 09 05:49 PM
Refer to other tabs in formula Gary T Excel Worksheet Functions 2 September 23rd 08 07:21 PM
Refer to formula in another sheet Jonsson Excel Discussion (Misc queries) 5 December 8th 05 01:09 PM
How do I set upa formula to refer back to that box to get the sum. Overbaked Excel Worksheet Functions 1 December 30th 04 07:29 PM
refer to a formula for use in a loop hotherps[_48_] Excel Programming 9 April 18th 04 12:11 PM


All times are GMT +1. The time now is 06:15 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"