Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default Cursor Movement in Macro

As each time I run the macro I want to go to the end then
down one line to add the next block of data.


Another way: set a range object to that cell and then
refer to that to update your sheet.

Dim cell as Range
Set cell = Cells(Rows.Count,"A").End(xlup).offset(1)
'Gives you the next available cell to paste your data
'Now you can paste it there
'Assuming you have already copied the contents to the
clipboard:
cell.PasteSpecial Paste:=xlPasteValues
Application.CutCopyMode = False

If you really want to activate the cell, then:
Cells(Rows.Count,"A").End(xlUp).Offset(1).Select

Also keep in mind the difference between xlDown and xlUp.
xlDown directs downward and stops at the first or last non-
empty cell of a contiguous area, depending on where the
starting range is. xlUp does the same (except that it
directs upward), and since the macro above starts at row
65536 and looks up from there, it always returns the
bottom-most empty cell in column A.

If you are pasting data and some of the data have blanks,
you have to use xlUp. Using xlDown for this activity may
overwrite some of your pasted data (I say 'may' because
non-Excel data exports sometimes contain empty cell gunk
that Excel thinks is data, therfore not falling victim to
the usual xlDown behavior with respect to empty cells).
Use xlDown only if you never anticipate to have blanks in
the pasted data. As a general rule, I use xlUp.


-----Original Message-----
Very simple question.

How do you move the cursor DOWN from a macro?

I am appending data from multipul database calls but
Excel does a

Selection.End(xlDown).Select
Range("A38").Select ***This line is the problem***

As each time I run the macro I want to go to the end then
down one line to add the next block of data.

What do I need to replace the second line of code with?

.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
cursor movement jed24 New Users to Excel 3 January 26th 10 06:24 AM
Cursor Movement? micah Excel Worksheet Functions 10 October 30th 07 04:18 AM
Cursor movement in a macro Kanga Excel Discussion (Misc queries) 3 January 11th 07 01:10 AM
Cursor Movement in Macro Don Guillett[_4_] Excel Programming 1 August 5th 03 04:52 PM
Cursor Movement in Macro Ron de Bruin Excel Programming 0 August 5th 03 04:43 PM


All times are GMT +1. The time now is 10:53 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"