Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default what is the Excel macro command equivalent to "end up"

I am trying to get a macro to go to the equivalent of the keystrokes end up
no matter where end up takes me. However, the record keystrokes macro
actually goes to the specific cell that end up took me when I recorded the
macro no matter where end up now takes me.

What I want the macro to do is as follows.

end, up, shift, right ctrl C, goto A25, ctrl V

In other words go up to the first cell with data, copy that cell and the one
to the right of it, and paste the copied data to row 25 columns A & B.
  #2   Report Post  
Posted to microsoft.public.excel.programming
KL KL is offline
external usenet poster
 
Posts: 201
Default what is the Excel macro command equivalent to "end up"

Hi Jim,

Is this what you ara after?

Sub test()
With ActiveSheet
.Range("A25:B25")=.Cells(65536, "A").End(xlUp).Resize(, 2)
End With
End Sub


Regards,
KL


"Jim Robinson" wrote in message
...
I am trying to get a macro to go to the equivalent of the keystrokes end up
no matter where end up takes me. However, the record keystrokes macro
actually goes to the specific cell that end up took me when I recorded the
macro no matter where end up now takes me.

What I want the macro to do is as follows.

end, up, shift, right ctrl C, goto A25, ctrl V

In other words go up to the first cell with data, copy that cell and the
one
to the right of it, and paste the copied data to row 25 columns A & B.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default what is the Excel macro command equivalent to "end up"

Thanks for the reply KL,
Not quite. First the macro runs a routine which finds the largest number in
a list (auto filter to 10 command). This works OK. Next I want to go to the
cell where that number is located and copy the contents of that cell and the
one to the right of it and then paste what I copied to another location.
The autofilter command hides all the rows in the list except the row that
contains the largest number. So, depending on the list, various rows get
hidden.
When I tried to make a "record keystrokes" macro do this, I used the end up
keys to go to the cell that contained the largest number. Then I used shift
right to highlight the two cells. Then I used ctrl V to past the copied
information elsewhere.
However, the macro didn't do the equivalent of end up. It recorded the
actual cell that end up took me to. So, when I run the macro, it goes to
that specific cell every time even though that cell may not now contain the
largest value in the list.


"KL" wrote:

Hi Jim,

Is this what you ara after?

Sub test()
With ActiveSheet
.Range("A25:B25")=.Cells(65536, "A").End(xlUp).Resize(, 2)
End With
End Sub


Regards,
KL


"Jim Robinson" wrote in message
...
I am trying to get a macro to go to the equivalent of the keystrokes end up
no matter where end up takes me. However, the record keystrokes macro
actually goes to the specific cell that end up took me when I recorded the
macro no matter where end up now takes me.

What I want the macro to do is as follows.

end, up, shift, right ctrl C, goto A25, ctrl V

In other words go up to the first cell with data, copy that cell and the
one
to the right of it, and paste the copied data to row 25 columns A & B.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 692
Default what is the Excel macro command equivalent to "end up"

Maybe this would help:

Dim rng As Range, tvalue

tvalue = Worksheetfunction.Max(Range("A:A")

Set rng = Cells.Find(tvalue)
If Not rng Is Nothing Then
MsgBox rng.Address
Else
MsgBox "Not Found"
End If

WkBk2.Sheets("InputSheet").Cells(rw,col) =
WkBk1.Sheets("MyData").Range(rng.address)

It is not always required to select anything.
The above finds the address of the cells and you can use this to copy to
another location.

--
steveB

Remove "AYN" from email to respond
"Jim Robinson" wrote in message
...
Thanks for the reply KL,
Not quite. First the macro runs a routine which finds the largest number
in
a list (auto filter to 10 command). This works OK. Next I want to go to
the
cell where that number is located and copy the contents of that cell and
the
one to the right of it and then paste what I copied to another location.
The autofilter command hides all the rows in the list except the row that
contains the largest number. So, depending on the list, various rows get
hidden.
When I tried to make a "record keystrokes" macro do this, I used the end
up
keys to go to the cell that contained the largest number. Then I used
shift
right to highlight the two cells. Then I used ctrl V to past the copied
information elsewhere.
However, the macro didn't do the equivalent of end up. It recorded the
actual cell that end up took me to. So, when I run the macro, it goes to
that specific cell every time even though that cell may not now contain
the
largest value in the list.


"KL" wrote:

Hi Jim,

Is this what you ara after?

Sub test()
With ActiveSheet
.Range("A25:B25")=.Cells(65536, "A").End(xlUp).Resize(, 2)
End With
End Sub


Regards,
KL


"Jim Robinson" wrote in message
...
I am trying to get a macro to go to the equivalent of the keystrokes end
up
no matter where end up takes me. However, the record keystrokes macro
actually goes to the specific cell that end up took me when I recorded
the
macro no matter where end up now takes me.

What I want the macro to do is as follows.

end, up, shift, right ctrl C, goto A25, ctrl V

In other words go up to the first cell with data, copy that cell and
the
one
to the right of it, and paste the copied data to row 25 columns A & B.






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default what is the Excel macro command equivalent to "end up"

Thanks for the help Steve,

Works fine until it gets to the last two lines of code. I assume I should
substitute something for some of the things in these two lines, but am
stumped. The message does always show the correct cell.

Also, is there not a macro command equivalent to the end and up keys? or for
the shift right keys? or for the ctrl C command? or for the ctrl V command?


"STEVE BELL" wrote:

Maybe this would help:

Dim rng As Range, tvalue

tvalue = Worksheetfunction.Max(Range("A:A")

Set rng = Cells.Find(tvalue)
If Not rng Is Nothing Then
MsgBox rng.Address
Else
MsgBox "Not Found"
End If

WkBk2.Sheets("InputSheet").Cells(rw,col) =
WkBk1.Sheets("MyData").Range(rng.address)

It is not always required to select anything.
The above finds the address of the cells and you can use this to copy to
another location.

--
steveB

Remove "AYN" from email to respond
"Jim Robinson" wrote in message
...
Thanks for the reply KL,
Not quite. First the macro runs a routine which finds the largest number
in
a list (auto filter to 10 command). This works OK. Next I want to go to
the
cell where that number is located and copy the contents of that cell and
the
one to the right of it and then paste what I copied to another location.
The autofilter command hides all the rows in the list except the row that
contains the largest number. So, depending on the list, various rows get
hidden.
When I tried to make a "record keystrokes" macro do this, I used the end
up
keys to go to the cell that contained the largest number. Then I used
shift
right to highlight the two cells. Then I used ctrl V to past the copied
information elsewhere.
However, the macro didn't do the equivalent of end up. It recorded the
actual cell that end up took me to. So, when I run the macro, it goes to
that specific cell every time even though that cell may not now contain
the
largest value in the list.


"KL" wrote:

Hi Jim,

Is this what you ara after?

Sub test()
With ActiveSheet
.Range("A25:B25")=.Cells(65536, "A").End(xlUp).Resize(, 2)
End With
End Sub


Regards,
KL


"Jim Robinson" wrote in message
...
I am trying to get a macro to go to the equivalent of the keystrokes end
up
no matter where end up takes me. However, the record keystrokes macro
actually goes to the specific cell that end up took me when I recorded
the
macro no matter where end up now takes me.

What I want the macro to do is as follows.

end, up, shift, right ctrl C, goto A25, ctrl V

In other words go up to the first cell with data, copy that cell and
the
one
to the right of it, and paste the copied data to row 25 columns A & B.








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 692
Default what is the Excel macro command equivalent to "end up"

These have to be on a single line. Note the line contiuation symbol _

WkBk2.Sheets("InputSheet").Cells(rw,col) = _
WkBk1.Sheets("MyData").Range(rng.address)

WkBk1 & WkBk2 are variable representations of 2 different workbooks
InputSheet & MyData are generic names for worksheets.
You need to change these to match your own situation.

The easiest way to capture the end up, down, sideways, etc commands is to
open a new workbook and just play with the macro recorder. Than edit the
code that is generated.

Recording is a great way to learn basic coding.

Be aware that my code is designed in such a way that there is no selecting
or activating.
When you can do that - the code runs faster.

-
steveB

Remove "AYN" from email to respond
"Jim Robinson" wrote in message
...
Thanks for the help Steve,

Works fine until it gets to the last two lines of code. I assume I should
substitute something for some of the things in these two lines, but am
stumped. The message does always show the correct cell.

Also, is there not a macro command equivalent to the end and up keys? or
for
the shift right keys? or for the ctrl C command? or for the ctrl V
command?


"STEVE BELL" wrote:

Maybe this would help:

Dim rng As Range, tvalue

tvalue = Worksheetfunction.Max(Range("A:A")

Set rng = Cells.Find(tvalue)
If Not rng Is Nothing Then
MsgBox rng.Address
Else
MsgBox "Not Found"
End If

WkBk2.Sheets("InputSheet").Cells(rw,col) =
WkBk1.Sheets("MyData").Range(rng.address)

It is not always required to select anything.
The above finds the address of the cells and you can use this to copy to
another location.

--
steveB

Remove "AYN" from email to respond
"Jim Robinson" wrote in message
...
Thanks for the reply KL,
Not quite. First the macro runs a routine which finds the largest
number
in
a list (auto filter to 10 command). This works OK. Next I want to go
to
the
cell where that number is located and copy the contents of that cell
and
the
one to the right of it and then paste what I copied to another
location.
The autofilter command hides all the rows in the list except the row
that
contains the largest number. So, depending on the list, various rows
get
hidden.
When I tried to make a "record keystrokes" macro do this, I used the
end
up
keys to go to the cell that contained the largest number. Then I used
shift
right to highlight the two cells. Then I used ctrl V to past the
copied
information elsewhere.
However, the macro didn't do the equivalent of end up. It recorded the
actual cell that end up took me to. So, when I run the macro, it goes
to
that specific cell every time even though that cell may not now contain
the
largest value in the list.


"KL" wrote:

Hi Jim,

Is this what you ara after?

Sub test()
With ActiveSheet
.Range("A25:B25")=.Cells(65536, "A").End(xlUp).Resize(, 2)
End With
End Sub


Regards,
KL


"Jim Robinson" wrote in
message
...
I am trying to get a macro to go to the equivalent of the keystrokes
end
up
no matter where end up takes me. However, the record keystrokes
macro
actually goes to the specific cell that end up took me when I
recorded
the
macro no matter where end up now takes me.

What I want the macro to do is as follows.

end, up, shift, right ctrl C, goto A25, ctrl V

In other words go up to the first cell with data, copy that cell and
the
one
to the right of it, and paste the copied data to row 25 columns A &
B.








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
COUNTIFS equivalent in Excel 2003 - both criteria have text, one has "wildcard" Courtney[_3_] Excel Worksheet Functions 3 April 20th 10 03:01 AM
Excel Equivalent of Access "Load" Event? LarryP Excel Discussion (Misc queries) 2 April 7th 10 08:44 PM
Is there an Excel 2003 equivalent to Word's "versions" function? Steve Excel Discussion (Misc queries) 0 March 4th 07 02:01 AM
Is there an equivalent of Lotus 123's "Paste visible" command? AJ Excel Discussion (Misc queries) 6 March 16th 06 09:21 AM
inserting a conditional "go to" command on a excel "if" function velasques Excel Worksheet Functions 5 March 10th 06 08:16 PM


All times are GMT +1. The time now is 11:48 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"