Results 1 to 2 of 2

copy rows to new sheet and plot graph

Threaded View

  1. #1
    Registered User
    Join Date
    02-17-2014
    Location
    Australia
    MS-Off Ver
    Excel 2010
    Posts
    1

    copy rows to new sheet and plot graph

    Hi,

    I have a data set in excel that i want to sort and copy accross to new tabs. I have created an VBA file than searches the columns for a specified value and copy's over the corresponding row. The program then deletes an rows with an empty cell. The VBA program then plots the resulting sorted data. I want to improve my graph quality by using a between function that only plots values between a certain range. Does anyone know how I would get VBA to do this? I assume it would be an IF function. I also want to put a button on the main sheet that if I press will come up with a message asking to enter the number that I want to copy accros to the new sheets and the button then makes a new tab.

    At the moment I have code that copy's and deletes blank rows. I made it from adding in other sections of code I found on this forum and it works quite well. Any help would be much appreaciated!

    Option Explicit
    
    Sub MyCopyMacro()
    
    
        Dim shtSearch As Worksheet
        Dim shtPaste As Worksheet
        Dim myLastSearchRow As Long
        Dim myCopyRow As Long
        Dim myPasteRow As Long
    
        Set shtSearch = Sheets("Sheet1")
    
        Set shtPaste = Sheets("27155-60")
    
        myPasteRow = 2
    
        Application.ScreenUpdating = False
        
    '   Find last row in column A
        shtSearch.Activate
        myLastSearchRow = shtSearch.Cells(Rows.Count, "A").End(xlUp).Row
    
    
    '   Loop through all cells in column A
        For myCopyRow = 1 To myLastSearchRow
           If InStr(LCase(shtSearch.Cells(myCopyRow, "A")), "27155-60") > 0 Then
                shtSearch.Rows(myCopyRow).Copy
                shtPaste.Activate
                Cells(myPasteRow, "A").Select
                ActiveSheet.Paste
                Application.CutCopyMode = False
                myPasteRow = myPasteRow + 4
                shtSearch.Activate
    
            End If
            
        Next myCopyRow
        
        Application.ScreenUpdating = True
        
        Worksheets("27155-60").Range("D1:D" & myLastSearchRow).SpecialCells(xlCellTypeBlanks).EntireRow.Delete
        
       
    End Sub
    Last edited by caly0307; 02-17-2014 at 10:40 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 1
    Last Post: 01-07-2013, 12:23 AM
  2. Line Graph - Do plot zero, Don't plot #NA
    By Janc in forum Excel Charting & Pivots
    Replies: 5
    Last Post: 04-01-2012, 05:45 PM
  3. [SOLVED] how do I create a box-plot (or whisker plot ) graph?
    By raal in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 08-08-2005, 04:05 PM
  4. Can I copy x-y scatter plot data direct from one plot to another?
    By Chris in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 06-03-2005, 09:05 AM
  5. [SOLVED] Plot a graph for each row in a sheet
    By Dave Munday in forum Excel General
    Replies: 2
    Last Post: 05-22-2005, 10:06 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