How to select visible range vba excel
<p>I have two excel spreadsheets, one spreadsheet which I will call x, I have created a macro, which filters the data perfectly.</p>

<p>The problem is I am trying to select and copy the visible range. The first step is for me to copy the visible range from spreadsheet x from column A to H excluding the headers into spreadsheet y.</p>

<p>The second Step is copy the headers and all the visible data after column i, J onward including the headers to the right and down in spreadsheet x and paste this into spreadsheet y, J1 onwards.</p>

<p>I have had a look on the internet there seems to be lot of articles regarding this but not on column ranges, but cells. I am quite a novice. I keep getting errors.</p>

<p>The reason why I think I will have to have x and y spreadsheet is because I am copying visible range twice. y spreadsheet is fixed, and is a cost file I will be creating, x is not fixed and the names will change every month, so I am thinking I might need to give it a name, so the macro runs correctly because its copying twice, needs to know the location to go back to</p>

<p>Your help and wisdom would be appreciated, I am keen to get some help with how to select the visible range and get the code. If you could add comments as to the what the code is doing. This would be a learning experience for me. This would be a learning experience for all the people which are novices like myself.</p>

<pre><code>Sub CrudeoilPrices()
Rows("1:1").Select
Selection.AutoFilter
ActiveSheet.Range("$A$1:$AU$28675").AutoFilter Field:=2, Criteria1:="Ainfo"
    ActiveSheet.Range("$A$1:$AU$28675").AutoFilter Field:=3, Criteria1:="BCostinfo"
    ActiveSheet.Range("$A$1:$AU$28675").AutoFilter Field:=4, Criteria1:="CMethodinfo"
    ActiveSheet.Range("$A$1:$AU$28675").AutoFilter Field:=8, Criteria1:=Array( _
        "Dinfo", "Einfo", "Finfo", "Hinfo", _
        "Iinfo"), Operator:=xlFilterValues
End Sub
</code></pre>