View Single Post
 
Old 10-13-2024, 01:53 PM
Logit Logit is offline Windows 10 Office 2007
Expert
 
Join Date: Jan 2017
Posts: 591
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default

the following will graph data in column J.

I don't understand what you mean by :

Quote:
and the corresponding value in the column M

Code:
Option Explicit

Sub y()
 Application.ScreenUpdating = False
 Worksheets("Sheet1").Range("J2").AutoFilter _
 Field:=1, _
 Criteria1:=">" & "14"   ', _

 Dim Sorce, Targt As Worksheet
    Set Sorce = ThisWorkbook.Sheets("Sheet1")
    Set Targt = ThisWorkbook.Sheets("Sheet2")

    Sorce.Range("J2:J100").SpecialCells(xlCellTypeVisible).Copy
    Targt.Cells(1, 1).PasteSpecial
    Sheets("Sheet2").Activate
    Sheets("Sheet2").Range("A1").Select
    Macro1
   
    
    Range("A1").Select
    Application.CutCopyMode = False
    Application.Wait Now + #12:00:02 AM#
    
Sheets("Sheet1").Activate
Range("A1").Select

 On Error Resume Next
'If ActiveSheet.FilterMode Then ActiveSheet.ShowAllData

'If ActiveSheet.AutoFilterMode Then ActiveSheet.ShowAllData
Cells.AutoFilter
Application.ScreenUpdating = True

End Sub

Sub Macro1()
'
' Macro1 Macro
'

'
    ActiveSheet.Shapes.AddChart.Select
    Dim rng As Range
   
    Dim cht As Object
    Dim LastRow As Long
    
    LastRow = Cells(Rows.Count, "A").End(xlUp).Row
    
    Set rng = ActiveSheet.Range("A1:A" & LastRow)
    'rng.Select

    ActiveChart.SetSourceData Source:=rng
    ActiveChart.ChartType = xlColumnClustered
End Sub
Attached Files
File Type: xlsm Book1.xlsm (21.6 KB, 5 views)
Reply With Quote