Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default lookup cell value

Hi

I am trying to use VBA to pick up a cell value (company name) generated by a
combo box and create charts based upon that value. I have 2 companies to
which there are varying providers and values associated to each provider.
The raw data is held on one sheet. Company A, in A2:B12 and Company B, in
A14:B40. Where column A in the provider name and column B the numerical
value. The main worksheet houses the combo-box to which the desired company
can be selected and numerous buttons which all generate different charts.

I would be grateful for any help, if my explaination of my problem makes any
sense to anyone.

TIA

Rich
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default lookup cell value

I cannot tell what your question is.


"RichHoughton" wrote:

Hi

I am trying to use VBA to pick up a cell value (company name) generated by a
combo box and create charts based upon that value. I have 2 companies to
which there are varying providers and values associated to each provider.
The raw data is held on one sheet. Company A, in A2:B12 and Company B, in
A14:B40. Where column A in the provider name and column B the numerical
value. The main worksheet houses the combo-box to which the desired company
can be selected and numerous buttons which all generate different charts.

I would be grateful for any help, if my explaination of my problem makes any
sense to anyone.

TIA

Rich

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default lookup cell value

Your combo box will place the selected value in a cell you determine, let's
say C1. You can see that information with a line of code something like:

CompanyName=Range("C1").Value

Rob

"RichHoughton" wrote:

Hi

I am trying to use VBA to pick up a cell value (company name) generated by a
combo box and create charts based upon that value. I have 2 companies to
which there are varying providers and values associated to each provider.
The raw data is held on one sheet. Company A, in A2:B12 and Company B, in
A14:B40. Where column A in the provider name and column B the numerical
value. The main worksheet houses the combo-box to which the desired company
can be selected and numerous buttons which all generate different charts.

I would be grateful for any help, if my explaination of my problem makes any
sense to anyone.

TIA

Rich

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default lookup cell value

Hello

Sorry my explanation probably wasn't great. My core problem is assigning
the value generated by the combo-box, i.e company name, as a VBA variable. I
would then hope to check the variable, i.e IF variable = "Company A" THEN,
use range A2:B12 as the graph range, ELSE, use the range A14:B40.

I have this rubbish code so far;

Private Sub openform_Click()
Dim CompanyName As String
Sheets("lookup").Select
CompanyName = Range("B20").Text


If (CompanyName = "CompanyA") Then
Sheets("rich").Select
ActiveChart.PlotArea.Select
ActiveChart.SeriesCollection.XValues = "=lookup!R2C1:R12C2"
Else
Sheets("rich").Select
ActiveChart.PlotArea.Select
ActiveChart.SeriesCollection.XValues = "=lookup!R2C14:R40C2"
End If

End Sub

Thanks for responding

Rich

"Tim Kredlo" wrote:

I cannot tell what your question is.


"RichHoughton" wrote:

Hi

I am trying to use VBA to pick up a cell value (company name) generated by a
combo box and create charts based upon that value. I have 2 companies to
which there are varying providers and values associated to each provider.
The raw data is held on one sheet. Company A, in A2:B12 and Company B, in
A14:B40. Where column A in the provider name and column B the numerical
value. The main worksheet houses the combo-box to which the desired company
can be selected and numerous buttons which all generate different charts.

I would be grateful for any help, if my explaination of my problem makes any
sense to anyone.

TIA

Rich

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default lookup cell value

FYI Finally got it to work. The combo box generates a number, i.e. 1. Then
i use this code;

Private Sub openform_Click()
Dim PCT As String
Sheets("lookup").Select

PCT = Worksheets("lookup").Range("B9")

If (PCT = "1") Then
Sheets("richchart").Select
ActiveChart.PlotArea.Select
ActiveChart.SetSourceData Source:=Sheets("lookup").Range("E4:G23")
Else
Sheets("richchart").Select
ActiveChart.PlotArea.Select
ActiveChart.SetSourceData Source:=Sheets("lookup").Range("E27:G63")
End If

End Sub

Which works.

Thanks all

R

"Fordguy" wrote:

Your combo box will place the selected value in a cell you determine, let's
say C1. You can see that information with a line of code something like:

CompanyName=Range("C1").Value

Rob

"RichHoughton" wrote:

Hi

I am trying to use VBA to pick up a cell value (company name) generated by a
combo box and create charts based upon that value. I have 2 companies to
which there are varying providers and values associated to each provider.
The raw data is held on one sheet. Company A, in A2:B12 and Company B, in
A14:B40. Where column A in the provider name and column B the numerical
value. The main worksheet houses the combo-box to which the desired company
can be selected and numerous buttons which all generate different charts.

I would be grateful for any help, if my explaination of my problem makes any
sense to anyone.

TIA

Rich

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
formula to lookup data in cell NEXT to another cell TraderXL Excel Worksheet Functions 3 June 22nd 09 01:44 PM
Get Cell Address From Lookup (Alternative to Lookup) ryguy7272 Excel Worksheet Functions 12 September 28th 07 10:36 PM
Need to lookup value in cell, dependent on value in another cell StaceyJ Excel Worksheet Functions 1 April 20th 07 09:24 PM
formatting a cell the same as the source cell from a lookup table hot dogs Excel Discussion (Misc queries) 2 August 24th 06 11:07 AM
lookup more than one cell andrewm Excel Worksheet Functions 20 June 14th 05 05:33 AM


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