Dynamic Range and Next Available Row

Horvy

New Member
Joined
Jun 4, 2008
Messages
2
I am having some trouble using the Dynamic Range and Next Avaiable forumals that I devised within my macro. I recorded the macro first, and then edited it with the dynamic range and next available row in a colum macros.

Code:
Sub K2TORMTMAccDetailLD_General_S()
Cells.Select
    Selection.AutoFilter
    Selection.AutoFilter Field:=5, Criteria1:="INT-ALM"
    Range(("A2"), Range("N65536").End(xlUp)).Select
    Selection.EntireRow.Delete
    Selection.AutoFilter
    Selection.Copy
    Sheets("K2MTM").Select
    Dim LastCell As Range
      With ActiveSheet
      Set LastCell = .Cells(.Rows.Count, "A").End(xlUp)
      If IsEmpty(LastCell) Then
       'do nothing
       Else
      Set LastCell = LastCell.Offset(1, 0)
      End If
    End With
    MsgBox LastCell.Row
    ActiveSheet.Paste
End Sub

Thanks
 
Last edited by a moderator:

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Hi there,

Can you provide us with more information, such as what this is supposed to do? What the desired out come is and what it is currently doing. We can read the code, but what you expect as an outcome really matters here. :)

Also, please explain your data structure to us. I.e. what rows contain headers, what row your data starts on, the size of the data table, etc. You have a lot of Select's in your code, which isn't needed, but it is a detractant for us because we can't "see" what you're selecting. ;)
 
Upvote 0

Forum statistics

Threads
1,215,022
Messages
6,122,716
Members
449,093
Latest member
Mnur

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top