UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Stop Macro At This Point, Office 2007    
 
   
Frank Situmorang
post May 8 2019, 06:20 PM
Post#1



Posts: 1,203
Joined: 10-June 10



Hello,

My macro stop here (marked in Yellow), if anybody can help me why did it stop.

Here is my VBA and the error message pictures.

Thank you
This post has been edited by Frank Situmorang: May 8 2019, 06:22 PM
Attached File(s)
Attached File  Runtimeerror1004.jpg ( 251.19K )Number of downloads: 12
Attached File  Stop_on_ActiveSheet.Paste.jpg ( 221.71K )Number of downloads: 16
 

--------------------
Frank S
Highland, CA
Go to the top of the page
 
June7
post May 8 2019, 06:22 PM
Post#2



Posts: 657
Joined: 25-January 16



No VBA and no pictures posted.

Post VBA and message as text, not images. Post code between CODE tags.

This post has been edited by June7: May 8 2019, 06:23 PM

--------------------
Attachments Manager is below the edit post window. To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
DEBUG! DEBUG! DEBUG! http://www.cpearson.com/Excel/DebuggingVBA.aspx
Go to the top of the page
 
Debaser
post May 9 2019, 06:58 AM
Post#3



Posts: 126
Joined: 11-October 18



Best guess would be that you copied something including merged cells, or you copied something that won't fit on the sheet you're pasting to.
Go to the top of the page
 
Frank Situmorang
post Jun 16 2019, 04:59 PM
Post#4



Posts: 1,203
Joined: 10-June 10



Hi Debaser:

On the following VBA:

Range("B2").Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select

What is the VBA when we want to say, If Cell B3 is empty it does not need to do Range(Selection, Selection.End(xlDown)).Select, it just go to Range(Selection, Selection.End(xlToRight)).Select, but if Cell B3 not empty it will do

Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select

Thank you for any help.

Frank

--------------------
Frank S
Highland, CA
Go to the top of the page
 
Debaser
post Jun 17 2019, 02:34 AM
Post#5



Posts: 126
Joined: 11-October 18



Just add an If test:

CODE
If len(range("B3").value) <> 0 then Range(Selection, Selection.End(xlDown)).Select
Go to the top of the page
 
Frank Situmorang
post Jun 17 2019, 03:19 PM
Post#6



Posts: 1,203
Joined: 10-June 10



Thank you Debaser, but could you enlighten me again I already put the if test, and I took the example of B3 is empty, but it 's still doing xdown, this is my VBA

Sheets("Donor").Select
Range("B2").Select
If Len(Range("B3").Value) <> 0 Then Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Sheets("summary").Select
Range("A3").Select
ActiveSheet.Paste

Could you tell me where I am wrong?

Thank you

Frank


--------------------
Frank S
Highland, CA
Go to the top of the page
 
Frank Situmorang
post Jun 17 2019, 03:32 PM
Post#7



Posts: 1,203
Joined: 10-June 10



Sorry Debaser, you are right in fact I do not need to put anymore this
Range(Selection, Selection.End(xlDown)).Select

So it should have been:

Sheets("Donor").Select
Range("B2").Select
If Len(Range("B3").Value) <> 0 Then Range(Selection, Selection.End(xlDown)).Select
" Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Copy
Sheets("summary").Select
Range("A3").Select
ActiveSheet.Paste

And it works, again thank you very much

Frank

--------------------
Frank S
Highland, CA
Go to the top of the page
 
Debaser
post Jun 18 2019, 02:07 AM
Post#8



Posts: 126
Joined: 11-October 18



You're welcome. smile.gif
Go to the top of the page
 


Custom Search


RSSSearch   Top   Lo-Fi    23rd July 2019 - 02:19 AM