Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Excel/VBA Coding Help

Forgive the stupidity of the question, but I am an experienced Excel user
trying VBA for user forms for the first time.

I have an Excel spreadsheet that is a 2 column Cost Savings Calculator. It
compares costs between two different products. The formula is fairly complex,
so I created a VBA user form.

My problem is that it looks great, but I can't figure out the coding. I
basically need the Excel cells to populate the corresponding VBA form fields.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default Excel/VBA Coding Help

It depends on the object you are using, but you could iterate over cell until
you find a break point (let's say an empty cell) and put values inside the
control (usually control.add or addItem).
To iterate over rows:
i=0;
while (Range(cellStart).Offset(i,0) <"")
control.add (Range(cellStart).Offset(i,0).value) 'check the right way!
wend

"JoeMathews" wrote:

Forgive the stupidity of the question, but I am an experienced Excel user
trying VBA for user forms for the first time.

I have an Excel spreadsheet that is a 2 column Cost Savings Calculator. It
compares costs between two different products. The formula is fairly complex,
so I created a VBA user form.

My problem is that it looks great, but I can't figure out the coding. I
basically need the Excel cells to populate the corresponding VBA form fields.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default VBA Coding

I would name the ranges containing the target values, then when the form initilizes:

Private Sub UserForm_Initialize()
Me.TextBox1.Value = Application.Range("firstnamedrange").Value

End Sub

This ties the textbox1 to the value in the named range.

Hope this helps.
Tom



JoeMathews wrote:

Excel/VBA Coding Help
13-Nov-09

Forgive the stupidity of the question, but I am an experienced Excel user
trying VBA for user forms for the first time.

I have an Excel spreadsheet that is a 2 column Cost Savings Calculator. It
compares costs between two different products. The formula is fairly complex,
so I created a VBA user form.

My problem is that it looks great, but I cannot figure out the coding. I
basically need the Excel cells to populate the corresponding VBA form fields.

Previous Posts In This Thread:

EggHeadCafe - Software Developer Portal of Choice
Test-Driven Development in Microsoft .NET
http://www.eggheadcafe.com/tutorials...lopment-i.aspx
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 149
Default Excel/VBA Coding Help

JoeMathews,

I'm not sure how a two product cost comparison would yield a complex formula
that requires the use of a UserForm, but nonetheless, there needs to be more
detail behind what you are trying to accomplish. Some sample questions that
I'm sure most people will be wondering about are below.

What types of controls does your UserForm contain? Is it something where
the user selects an item from ComboBox1, selects an item from ComboBox2, and
then clicks a CommandButton that executes the formula? Whenever a result is
created, where on the spreadsheet do you want it to end up? Do you want a
TextBox value and ComboBox value to be inserted onto the spreadsheet and if
so where on the spreadsheet do you want those values inserted? Are the
UserForm inputs necessary to the formula calculation, and if so how are the
inputs related? (I think you get the point regarding how to be more
detailed).

It general, the more specific you are, the better posters will be able to
assist you. Also, if you have VBA code, post it along with where you are
experiencing problems (or have questions, difficulties, etc.) with the code.
It's nice to know that your UserForm looks great, but your description leaves
everyone wondering what's going on with the guts behind the UserForm.

Best,

Matthew Herbert

"JoeMathews" wrote:

Forgive the stupidity of the question, but I am an experienced Excel user
trying VBA for user forms for the first time.

I have an Excel spreadsheet that is a 2 column Cost Savings Calculator. It
compares costs between two different products. The formula is fairly complex,
so I created a VBA user form.

My problem is that it looks great, but I can't figure out the coding. I
basically need the Excel cells to populate the corresponding VBA form fields.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 149
Default Excel/VBA Coding Help

JoeMathews,

I initial read your post incorrectly, however, the questions regarding the
type of control(s) you want filled is very relevant in this case. If your
control is a ListBox or ComboBox, look up .List (which can be an array
reference), .RowSource (which can be a spreadsheet location reference),
..AddItem (which can be a single addition) in the help section.

Best,

Matt

"Matthew Herbert" wrote:

JoeMathews,

I'm not sure how a two product cost comparison would yield a complex formula
that requires the use of a UserForm, but nonetheless, there needs to be more
detail behind what you are trying to accomplish. Some sample questions that
I'm sure most people will be wondering about are below.

What types of controls does your UserForm contain? Is it something where
the user selects an item from ComboBox1, selects an item from ComboBox2, and
then clicks a CommandButton that executes the formula? Whenever a result is
created, where on the spreadsheet do you want it to end up? Do you want a
TextBox value and ComboBox value to be inserted onto the spreadsheet and if
so where on the spreadsheet do you want those values inserted? Are the
UserForm inputs necessary to the formula calculation, and if so how are the
inputs related? (I think you get the point regarding how to be more
detailed).

It general, the more specific you are, the better posters will be able to
assist you. Also, if you have VBA code, post it along with where you are
experiencing problems (or have questions, difficulties, etc.) with the code.
It's nice to know that your UserForm looks great, but your description leaves
everyone wondering what's going on with the guts behind the UserForm.

Best,

Matthew Herbert

"JoeMathews" wrote:

Forgive the stupidity of the question, but I am an experienced Excel user
trying VBA for user forms for the first time.

I have an Excel spreadsheet that is a 2 column Cost Savings Calculator. It
compares costs between two different products. The formula is fairly complex,
so I created a VBA user form.

My problem is that it looks great, but I can't figure out the coding. I
basically need the Excel cells to populate the corresponding VBA form fields.



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
Need a little excel coding help hshayh0rn Excel Programming 12 May 5th 09 04:53 PM
help me excel coding Chetan[_2_] Excel Programming 1 December 6th 07 11:55 AM
help with coding in excel associates Excel Worksheet Functions 3 June 7th 06 10:41 AM
Implant macro coding into ASP coding Sam yong Excel Programming 5 September 15th 05 10:37 AM
C C+ Excel Coding David Copp[_2_] Excel Programming 3 January 27th 04 05:11 AM


All times are GMT +1. The time now is 04:38 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"