Excel 2013 - VB code for a simple process to move down a single row

I only know a little about VB - enough to be dangerous. If I have the following code, how can I change it to move down a single row without it naming a specific range – “A1342” in this example????? I do not want it to put the actual range in there; I just want to move down a single row. Thanks.

Sub Remove_Blanks()
'
' Remove_Blanks Macro
' Delete blank rows
'

'
    Range("A1342").Select
    Range(Selection, Selection.End(xlDown)).Select
    Selection.EntireRow.Delete
    ActiveSheet.ShowAllData
    Range("A2").Select
End Sub
esu4236Asked:
Who is Participating?
 
esu4236Connect With a Mentor Author Commented:
The user figured it out - It was the Offset(1,0).  Thanks.
0
 
KimputerCommented:
Assuming you want the code to change to where you put your cursor (or to be more exact, the cell you clicked):

Sub Remove_Blanks()
'
' Remove_Blanks Macro
' Delete blank rows
'

'
    ActiveCell.Select
    
    Range(Selection, Selection.End(xlDown)).Select
    Selection.EntireRow.Delete
    If ActiveSheet.FilterMode = True Then
        ActiveSheet.ShowAllData
    End If
    Range("A2").Select
End Sub

Open in new window


Your code is set to delete stuff, while your post mentions moving down, which is basically a different thing. I left the code as it is, until you ask for other instructions.
0
 
esu4236Author Commented:
Ignoring the deleting of the blank rows part, I just want the line of code shown below to move down a single row rather than going to this particular cell:

Range("A1342").Select
0
 
KimputerCommented:
Sub Move_down()
'
' select current
' Jump one cell down

    ActiveCell.Select
    Selection.Offset(1, 0).Select
    
End Sub

Open in new window


This code just jumps one down. From where you clicked the last time (as you said, you don't want to specify the cell, which means you have to click a cell and then run this code)
0
 
esu4236Author Commented:
Because a user on my end figured it out.
0
All Courses

From novice to tech pro — start learning today.