Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ed Ed is offline
external usenet poster
 
Posts: 46
Default macro Cell designation


When I run this macro:

-------------------------------------------------------

For z = 5 To 100
Range("Jz").Select
Application.CutCopyMode = False
Selection.Cut
Range("J(z-1)").Select
ActiveSheet.Paste

Next

----------------------------------------------------------------

I get message:

-----------------------------------------------------------------

Run time error '1004':

Method ' Range' of object _'Global failed"

----------------------------------------------------------------

Please tell me how to correct the code.

Thanks.

Ed
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 222
Default macro Cell designation

use Cells instead of Range i.e.

For z = 5 To 100
Cells(z,10).Select
Application.CutCopyMode = False
Selection.Cut
Cells(z-1,10).Select
ActiveSheet.Paste

Next




"Ed" wrote:


When I run this macro:

-------------------------------------------------------

For z = 5 To 100
Range("Jz").Select
Application.CutCopyMode = False
Selection.Cut
Range("J(z-1)").Select
ActiveSheet.Paste

Next

----------------------------------------------------------------

I get message:

-----------------------------------------------------------------

Run time error '1004':

Method ' Range' of object _'Global failed"

----------------------------------------------------------------

Please tell me how to correct the code.

Thanks.

Ed

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 145
Default macro Cell designation

Why not cut the whole range and move up one row instead of looping

To fix your code (you should do this without selecting):

For z = 5 To 100

Range("J" & z).Select

Application.CutCopyMode = False

Selection.Cut

Range("J" & z-1).Select

ActiveSheet.Paste

Next


--
Damon Longworth

2006 West Coast Excel / Access User Conference
October 25-27th, 2006
Marina del Rey Hotel
Marina del Rey, California USA
http://www.exceluserconference.com/WCEUC.html

"Ed" wrote in message
...

When I run this macro:

-------------------------------------------------------

For z = 5 To 100
Range("Jz").Select
Application.CutCopyMode = False
Selection.Cut
Range("J(z-1)").Select
ActiveSheet.Paste

Next

----------------------------------------------------------------

I get message:

-----------------------------------------------------------------

Run time error '1004':

Method ' Range' of object _'Global failed"

----------------------------------------------------------------

Please tell me how to correct the code.

Thanks.

Ed



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default macro Cell designation

Ed,
As Damon pointed out, Range("Jz") does not evaluate to the cells J5, J6,
J7...., but if anything to the column JZ, which is out of range for versions
of excel before 2007.
So what you need is Range("J" & z).

Also, .Select is seldom necessary or desirable.
And you can the whole thing in one operation :

With Range("J5:J100")
.Cut Destination:=.Offset(-1,0)
End With

NickHK

"Ed" wrote in message
...

When I run this macro:

-------------------------------------------------------

For z = 5 To 100
Range("Jz").Select
Application.CutCopyMode = False
Selection.Cut
Range("J(z-1)").Select
ActiveSheet.Paste

Next

----------------------------------------------------------------

I get message:

-----------------------------------------------------------------

Run time error '1004':

Method ' Range' of object _'Global failed"

----------------------------------------------------------------

Please tell me how to correct the code.

Thanks.

Ed



  #5   Report Post  
Posted to microsoft.public.excel.programming
Ed Ed is offline
external usenet poster
 
Posts: 46
Default macro Cell designation

Thank you both, Damon and Nick.

Problemis solved.

Thanks again,

ed English


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
separate names and designation from one cell into 2 colmun Khoshravan Excel Discussion (Misc queries) 7 March 3rd 09 09:38 PM
Cell designation Ed Excel Programming 4 June 18th 06 01:57 AM
cell designation wickd03 Excel Discussion (Misc queries) 5 March 23rd 06 08:49 PM
Invisible Text designation in cell? mshanaha Excel Worksheet Functions 0 June 30th 05 05:01 PM
Specific Row Designation Larry Excel Programming 2 June 9th 05 06:52 PM


All times are GMT +1. The time now is 08:21 AM.

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

About Us

"It's about Microsoft Excel"