+ Reply to Thread
Results 1 to 2 of 2

Creating search criteria and chart in macro VBA

  1. #1
    Forum Contributor
    Join Date
    11-09-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    390

    Creating search criteria and chart in macro VBA

    Hello All,

    I have bunch of data (Data page in attached file) which contains some Parameters, Sample ID, No of visitors and etc. I'd like to see a chart/graph of a type of parameter for a specific sample ID against against another parameter with specific sampl ID (for example in attached file Ammonium raw_water against ammonium outflow) or a parameter against No of visitors (for example Ammonium raw_water against visitors). My idea to this was to creat a search criteria (see sheet "search" in attached file) to search required data from drop down list and search from the database through a search button and when data displays a chart to related data be created by clicking on a chart button.

    Any idea how can I programme this in VBA and macro? I really appreciate every little help.

    I have attached the file for better understanding.

    Cheers,
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    11-09-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    390

    Re: Creating search criteria and chart in macro VBA

    I have used the following code to get the data for the first part but nothing shows after I assigned the macro and run the module.

    Sub get_search_criteria_Data()
    macro_sheet = ActiveWorkbook.Name
    outpt = ActiveSheet.Name
    Range("A6").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.EntireRow.Delete
    Range("B3").Select
    search_value = Sheets("" & outpt & "").Range("B3").Value
    Sheets("Data").Select
    lrow = Sheets("Data").Range("A2:A" & Range("A" & Rows.Count).End(xlUp).Row).Count
    lcolumn = ActiveSheet.UsedRange.Columns.Count
    For i = 1 To lrow
    If Workbooks("" & macro_sheet & "").Sheets("Data").Cells(i, 2) = Workbooks("" & macro_sheet & "").Sheets("" & outpt & "").Cells(3, 2) Then
    For i2 = 6 To lrow
    If Workbooks("" & macro_sheet & "").Sheets("" & outpt & "").Cells(i2, 2) = "" Then
    For j = 1 To lcolumn
    Workbooks("" & macro_sheet & "").Sheets("" & outpt & "").Cells(i2, j) = Workbooks("" & macro_sheet & "").Sheets("Data").Cells(i, j)
    Next
    Exit For
    End If
    Next
    End If
    Next
    Sheets("" & outpt & "").Select
    Range("B3").Select
    End Sub

    Any idea where I am doing it wrong?

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 4
    Last Post: 05-20-2014, 10:03 AM
  2. Creating search box in cell - Currently using Macro 'Range to search' *HELP*
    By jacko058 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-14-2014, 05:24 AM
  3. Creating a comma seperated list based on a search criteria from a column
    By HUGH JORGAN in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 10-30-2013, 05:20 PM
  4. Replies: 4
    Last Post: 01-08-2013, 12:37 PM
  5. creating VB code using advanced search criteria with multiple data validation lists?
    By Jonathan Bay in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-14-2011, 09:56 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1