ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Insert cell anywhere (https://www.excelbanter.com/excel-programming/332844-insert-cell-anywhere.html)

J.Reynolds

Insert cell anywhere
 
I am trying to insert some cells that I have formatted into a spreadsheet at
a point where entries finish. This could be anywhere on the sheet. So far I
have managed:- Range("A600:D602").Select
Selection.Copy
Range("..????")Select
Active Sheet Paste.
How can I tell the macro to enter my cells at the cell which I selected
without stipulating an actual cell?

Ken Loomis

Insert cell anywhere
 
I am really not the expert here, but I wonder if you did what I always used
to do. That was to first select, via the VBA code, whatever I wanted to
copy. Which I soon found out I did not have to do.

It sounds like you are selecting a cell and then activating the procedure to
copy something from cell A600:D602, and then wanted that to be pasted
wherever you have selected.

If so, I think you could try this:

Range("A600:D602").Copy
Selection.Paste

I am sure the real gurus around here will have a better answer, but maybe
that will give you something to try until they answer.

Ken


"J.Reynolds" wrote in message
...
I am trying to insert some cells that I have formatted into a spreadsheet
at
a point where entries finish. This could be anywhere on the sheet. So
far I
have managed:- Range("A600:D602").Select
Selection.Copy
Range("..????")Select
Active Sheet Paste.
How can I tell the macro to enter my cells at the cell which I selected
without stipulating an actual cell?




Norman Jones

Insert cell anywhere
 
Hi J,

Assuming that column A is to be used to determine the end of existing data,
try:

Sub Tester04()

With ActiveSheet
.Range("A600:D602").Copy
.Paste (.Cells(Rows.Count, "A").End(xlUp)(2))
End With
End Sub

---
Regards,
Norman



"J.Reynolds" wrote in message
...
I am trying to insert some cells that I have formatted into a spreadsheet
at
a point where entries finish. This could be anywhere on the sheet. So
far I
have managed:- Range("A600:D602").Select
Selection.Copy
Range("..????")Select
Active Sheet Paste.
How can I tell the macro to enter my cells at the cell which I selected
without stipulating an actual cell?




J.Reynolds

Insert cell anywhere
 
Hi Ken,
Thanks for trying but at:- Selection.Paste I get a Runtime error '438'
Object doesn't support this property or method.

"Ken Loomis" wrote:

I am really not the expert here, but I wonder if you did what I always used
to do. That was to first select, via the VBA code, whatever I wanted to
copy. Which I soon found out I did not have to do.

It sounds like you are selecting a cell and then activating the procedure to
copy something from cell A600:D602, and then wanted that to be pasted
wherever you have selected.

If so, I think you could try this:

Range("A600:D602").Copy
Selection.Paste

I am sure the real gurus around here will have a better answer, but maybe
that will give you something to try until they answer.

Ken


"J.Reynolds" wrote in message
...
I am trying to insert some cells that I have formatted into a spreadsheet
at
a point where entries finish. This could be anywhere on the sheet. So
far I
have managed:- Range("A600:D602").Select
Selection.Copy
Range("..????")Select
Active Sheet Paste.
How can I tell the macro to enter my cells at the cell which I selected
without stipulating an actual cell?





J.Reynolds

Insert cell anywhere
 
Thanks for trying Norman but at End(xlUp)(2)) I get 'compile Error Expected
expression' and I dont know how to sort it out.


"Norman Jones" wrote:

Hi J,

Assuming that column A is to be used to determine the end of existing data,
try:

Sub Tester04()

With ActiveSheet
.Range("A600:D602").Copy
.Paste (.Cells(Rows.Count, "A").End(xlUp)(2))
End With
End Sub

---
Regards,
Norman



"J.Reynolds" wrote in message
...
I am trying to insert some cells that I have formatted into a spreadsheet
at
a point where entries finish. This could be anywhere on the sheet. So
far I
have managed:- Range("A600:D602").Select
Selection.Copy
Range("..????")Select
Active Sheet Paste.
How can I tell the macro to enter my cells at the cell which I selected
without stipulating an actual cell?





Norman Jones

Insert cell anywhere
 
Hi J,

I can't reproduce your problem.

Could you copy / paste your Sub's code into a reply?

---
Regards,
Norman



"J.Reynolds" wrote in message
...
Thanks for trying Norman but at End(xlUp)(2)) I get 'compile Error
Expected
expression' and I dont know how to sort it out.


"Norman Jones" wrote:

Hi J,

Assuming that column A is to be used to determine the end of existing
data,
try:

Sub Tester04()

With ActiveSheet
.Range("A600:D602").Copy
.Paste (.Cells(Rows.Count, "A").End(xlUp)(2))
End With
End Sub

---
Regards,
Norman



"J.Reynolds" wrote in message
...
I am trying to insert some cells that I have formatted into a
spreadsheet
at
a point where entries finish. This could be anywhere on the sheet. So
far I
have managed:- Range("A600:D602").Select
Selection.Copy
Range("..????")Select
Active Sheet Paste.
How can I tell the macro to enter my cells at the cell which I selected
without stipulating an actual cell?







J.Reynolds

Insert cell anywhere
 
Norman, I am new to this, it is easy in word but I am having trouble in
excel. So far I have:-
Sub Insert_Invoice_Total_Box()
Range ("A600:D602").Select
Selection.Copy
Range ("?").Select
ActiveSheet.Paste

EndSub

It is what to put for the question mark, it could be anywhere between A16
and A600. Reading other posts in the group J_Gold asked on 28th May "I would
like to be able to subtotal a column of numbers using the following formula:"
I havent been able to test that on my spreadsheet, but I dont mind if the
column doesn't subtotal I can do that manually, for now I want to insert
formatting so that I can subtotal, tax, shipping and total etc.
Thanks J.



"Norman Jones" wrote:

Hi J,

I can't reproduce your problem.

Could you copy / paste your Sub's code into a reply?

---
Regards,
Norman



"J.Reynolds" wrote in message
...
Thanks for trying Norman but at End(xlUp)(2)) I get 'compile Error
Expected
expression' and I dont know how to sort it out.


"Norman Jones" wrote:

Hi J,

Assuming that column A is to be used to determine the end of existing
data,
try:

Sub Tester04()

With ActiveSheet
.Range("A600:D602").Copy
.Paste (.Cells(Rows.Count, "A").End(xlUp)(2))
End With
End Sub

---
Regards,
Norman



"J.Reynolds" wrote in message
...
I am trying to insert some cells that I have formatted into a
spreadsheet
at
a point where entries finish. This could be anywhere on the sheet. So
far I
have managed:- Range("A600:D602").Select
Selection.Copy
Range("..????")Select
Active Sheet Paste.
How can I tell the macro to enter my cells at the cell which I selected
without stipulating an actual cell?







Norman Jones

Insert cell anywhere
 
Hi J,

My original code:

'<<=====================
Sub Tester04()

With ActiveSheet
.Range("A600:D602").Copy
.Paste (.Cells(Rows.Count, "A").End(xlUp)(2))
End With
End Sub
'=====================

works fine for me.

Did you copy / paste it into your workbook to avoid any transcription
errors?

BTW, the last line of a macro should be:

End Sub (two words)

not

EndSub (one word)

as shown in your Insert_Invoice_Total_Box() sub. although this is probably
a simple typo.

---
Regards,
Norman



"J.Reynolds" wrote in message
...
Norman, I am new to this, it is easy in word but I am having trouble in
excel. So far I have:-
Sub Insert_Invoice_Total_Box()
Range ("A600:D602").Select
Selection.Copy
Range ("?").Select
ActiveSheet.Paste

EndSub

It is what to put for the question mark, it could be anywhere between A16
and A600. Reading other posts in the group J_Gold asked on 28th May "I
would
like to be able to subtotal a column of numbers using the following
formula:"
I havent been able to test that on my spreadsheet, but I dont mind if the
column doesn't subtotal I can do that manually, for now I want to insert
formatting so that I can subtotal, tax, shipping and total etc.
Thanks J.



"Norman Jones" wrote:

Hi J,

I can't reproduce your problem.

Could you copy / paste your Sub's code into a reply?

---
Regards,
Norman



"J.Reynolds" wrote in message
...
Thanks for trying Norman but at End(xlUp)(2)) I get 'compile Error
Expected
expression' and I dont know how to sort it out.


"Norman Jones" wrote:

Hi J,

Assuming that column A is to be used to determine the end of existing
data,
try:

Sub Tester04()

With ActiveSheet
.Range("A600:D602").Copy
.Paste (.Cells(Rows.Count, "A").End(xlUp)(2))
End With
End Sub

---
Regards,
Norman



"J.Reynolds" wrote in message
...
I am trying to insert some cells that I have formatted into a
spreadsheet
at
a point where entries finish. This could be anywhere on the sheet.
So
far I
have managed:- Range("A600:D602").Select
Selection.Copy
Range("..????")Select
Active Sheet Paste.
How can I tell the macro to enter my cells at the cell which I
selected
without stipulating an actual cell?









J.Reynolds

Insert cell anywhere
 
Thanks for replying again, I pasted your suggestion into my macro, it worked
but it only pasted it into rows 603,604 and 605. Is this because I have
formulas in all rows up to 599. As it is an invoice I would like to be able
to paste it just below the last entry, and this could be any row up to 600.
Regards J.

"Norman Jones" wrote:

Hi J,

My original code:

'<<=====================
Sub Tester04()

With ActiveSheet
.Range("A600:D602").Copy
.Paste (.Cells(Rows.Count, "A").End(xlUp)(2))
End With
End Sub
'=====================

works fine for me.

Did you copy / paste it into your workbook to avoid any transcription
errors?

BTW, the last line of a macro should be:

End Sub (two words)

not

EndSub (one word)

as shown in your Insert_Invoice_Total_Box() sub. although this is probably
a simple typo.

---
Regards,
Norman



"J.Reynolds" wrote in message
...
Norman, I am new to this, it is easy in word but I am having trouble in
excel. So far I have:-
Sub Insert_Invoice_Total_Box()
Range ("A600:D602").Select
Selection.Copy
Range ("?").Select
ActiveSheet.Paste

EndSub

It is what to put for the question mark, it could be anywhere between A16
and A600. Reading other posts in the group J_Gold asked on 28th May "I
would
like to be able to subtotal a column of numbers using the following
formula:"
I havent been able to test that on my spreadsheet, but I dont mind if the
column doesn't subtotal I can do that manually, for now I want to insert
formatting so that I can subtotal, tax, shipping and total etc.
Thanks J.



"Norman Jones" wrote:

Hi J,

I can't reproduce your problem.

Could you copy / paste your Sub's code into a reply?

---
Regards,
Norman



"J.Reynolds" wrote in message
...
Thanks for trying Norman but at End(xlUp)(2)) I get 'compile Error
Expected
expression' and I dont know how to sort it out.


"Norman Jones" wrote:

Hi J,

Assuming that column A is to be used to determine the end of existing
data,
try:

Sub Tester04()

With ActiveSheet
.Range("A600:D602").Copy
.Paste (.Cells(Rows.Count, "A").End(xlUp)(2))
End With
End Sub

---
Regards,
Norman



"J.Reynolds" wrote in message
...
I am trying to insert some cells that I have formatted into a
spreadsheet
at
a point where entries finish. This could be anywhere on the sheet.
So
far I
have managed:- Range("A600:D602").Select
Selection.Copy
Range("..????")Select
Active Sheet Paste.
How can I tell the macro to enter my cells at the cell which I
selected
without stipulating an actual cell?











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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com