Macro; Move 1 cell down (left, right..)

Venet

New Member
Joined
Jul 8, 2002
Messages
33
:confused: Hi there !

Simply need a code snippet - how to move 1 cell down...

As opposed to this:

Selection.End(xlDown).Select

which moves you to the bottom of the Range.


Must work on filtered ranges !
( So, no solutions like:
a = ActiveCell.Column
b = ActiveCell.Row
Cells(b+1,a).Select

please...)


Bye !
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Move 1 cell right:
Selection.Offset(0, 1).Select

Move 1 cell down:
Selection.Offset(1, 0).Select
 
Upvote 0
Just an FYI, you said you want it to work in a filtered range, which PureFire's code will not do - - it will select the next row whether filtered or not. One way to select the next filtered (visible) row:

Sub Test1()
Dim x As Long, y As Long
x = ActiveCell.Row
y = ActiveCell.Column
Do
x = x + 1
Loop Until Cells(x, y).EntireRow.Hidden = False
Cells(x, y).Select
End Sub


Unfortunately, the code looks like something you say you don't want, but it does what you say you want it to do.
 
Upvote 0
What do you want to do once you have jumped to the next cell?

This may not quite be what you are after, but it could get you thinking...

Code:
Sub GrabFilteredRange()

Dim MyRange As Range
Dim c As Range

    ActiveCell.CurrentRegion.Select
    Set MyRange = Selection.SpecialCells(xlCellTypeVisible)
    
    For Each c In MyRange
      Debug.Print c.Value
    Next c
End Sub

This goes in sequence along each row in your range, visiting only the visible cells, and writes them out to the debug window. Presumably you could further restrict the range of movement by intersecting with Column A
 
Upvote 0
I think I have a similar question but am not sure. I have created a macro that copies fields to a separate tab/table in Excel and linked the macro to a command button. Each time the processer uses types in the data on the specified fields and clicks the button, I want that data copied to the next table and cleared out of the entry fields. The reason I am saying that my problem is similar is I want each time they process the macro for excel to past all the fields one row lower than the previous so the data isn't overwritten but added to the listing. Any help you can provide is greatly appreciated. If you have any questions, please let me know. Thank you.

Jeremy
 
Upvote 0
Hi All, I am looking for a MACRO to Help me add Data from Different Workbooks into 1 Workbook.
For example i have more than 30 Different Workbooks,all Named as let's say "1234","4567","2345","2398"......etc.
These Sheets are placed in a Common Shared Folder.
I need to Pick up Workbook "1234" the data from "Column 2" to the last Used Column on the Right(lets say Column 2 to Column 5 for example).......and then I want to paste that on the MasterSheet.
Now Open the Next Workbook that is "4567" and Pick up the Data from Column 2 again( till the last Used column, in this case let's Say Column 2 to Column 7).....and then paste it in MasterSheet on the Next Column of the previous Data(from "1234").
Similarly keep on pasting the data into MasterSheet sideways( left to right), till the Last Workbook in the Folder is Finished.
Please let me know if the requirement is Difficult to understand.
 
Upvote 0

Forum statistics

Threads
1,213,482
Messages
6,113,915
Members
448,532
Latest member
9Kimo3

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