Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Beginner macro programming question

Hi, I want to automate a simple task but know nothing about Excel macro
programming. The macro recorder doesn't do what I want so I guess I need to
write something.

I'd like to perform the following steps in a macro:

1. Cut the contents of the current cell
2. Move over 3 columns to the right
3. Paste the cut data.
4. Move back over to the original position and 1 row down.

That's it. I know, too easy? But I have no idea where to start. If
someone can get me started I can take it from there for the rest of my macro
needs.

Thanks for any help

Steve
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Beginner macro programming question

How about:

Sub steve2()
With ActiveCell
.Copy .Offset(0, 3)
.Clear
.Offset(1, 0).Select
End With
End Sub
--
Gary''s Student - gsnu200757


"highland" wrote:

Hi, I want to automate a simple task but know nothing about Excel macro
programming. The macro recorder doesn't do what I want so I guess I need to
write something.

I'd like to perform the following steps in a macro:

1. Cut the contents of the current cell
2. Move over 3 columns to the right
3. Paste the cut data.
4. Move back over to the original position and 1 row down.

That's it. I know, too easy? But I have no idea where to start. If
someone can get me started I can take it from there for the rest of my macro
needs.

Thanks for any help

Steve

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Beginner macro programming question

Perfect! Thanks.

Side note.. why can't I replace the ".Copy" with ".Cut", thereby removing
the requirement to also perform the ".Clear"?

I tried it and it have no idea what it really did... it definitely didn't
work though :-)

"Gary''s Student" wrote:

How about:

Sub steve2()
With ActiveCell
.Copy .Offset(0, 3)
.Clear
.Offset(1, 0).Select
End With
End Sub
--
Gary''s Student - gsnu200757


"highland" wrote:

Hi, I want to automate a simple task but know nothing about Excel macro
programming. The macro recorder doesn't do what I want so I guess I need to
write something.

I'd like to perform the following steps in a macro:

1. Cut the contents of the current cell
2. Move over 3 columns to the right
3. Paste the cut data.
4. Move back over to the original position and 1 row down.

That's it. I know, too easy? But I have no idea where to start. If
someone can get me started I can take it from there for the rest of my macro
needs.

Thanks for any help

Steve

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Beginner macro programming question

Actually you can use Cut. For example:

Sub steve()
ActiveCell.Cut
ActiveCell.Offset(0, 3).Select
ActiveSheet.Paste
ActiveCell.Offset(1, -3).Select
End Sub

will do the same thing. This version requires 2 Selects - one to go to the
paste cell and one to get back. Rumor has it that Selects make macros slow.
I don't think it really matters here. Either code will do.
--
Gary''s Student - gsnu200757


"highland" wrote:

Perfect! Thanks.

Side note.. why can't I replace the ".Copy" with ".Cut", thereby removing
the requirement to also perform the ".Clear"?

I tried it and it have no idea what it really did... it definitely didn't
work though :-)

"Gary''s Student" wrote:

How about:

Sub steve2()
With ActiveCell
.Copy .Offset(0, 3)
.Clear
.Offset(1, 0).Select
End With
End Sub
--
Gary''s Student - gsnu200757


"highland" wrote:

Hi, I want to automate a simple task but know nothing about Excel macro
programming. The macro recorder doesn't do what I want so I guess I need to
write something.

I'd like to perform the following steps in a macro:

1. Cut the contents of the current cell
2. Move over 3 columns to the right
3. Paste the cut data.
4. Move back over to the original position and 1 row down.

That's it. I know, too easy? But I have no idea where to start. If
someone can get me started I can take it from there for the rest of my macro
needs.

Thanks for any help

Steve

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 79
Default Beginner macro programming question

Hi all,

Using the ActiveCell method will mean that your starting cell need to be in
the current cell position where the data is, what if I want to move the data
but I am
not in my starting cell position.

I think we can use the Range method but not sure how to write the codes
Thanks



"Gary''s Student" wrote:

Actually you can use Cut. For example:

Sub steve()
ActiveCell.Cut
ActiveCell.Offset(0, 3).Select
ActiveSheet.Paste
ActiveCell.Offset(1, -3).Select
End Sub

will do the same thing. This version requires 2 Selects - one to go to the
paste cell and one to get back. Rumor has it that Selects make macros slow.
I don't think it really matters here. Either code will do.
--
Gary''s Student - gsnu200757


"highland" wrote:

Perfect! Thanks.

Side note.. why can't I replace the ".Copy" with ".Cut", thereby removing
the requirement to also perform the ".Clear"?

I tried it and it have no idea what it really did... it definitely didn't
work though :-)

"Gary''s Student" wrote:

How about:

Sub steve2()
With ActiveCell
.Copy .Offset(0, 3)
.Clear
.Offset(1, 0).Select
End With
End Sub
--
Gary''s Student - gsnu200757


"highland" wrote:

Hi, I want to automate a simple task but know nothing about Excel macro
programming. The macro recorder doesn't do what I want so I guess I need to
write something.

I'd like to perform the following steps in a macro:

1. Cut the contents of the current cell
2. Move over 3 columns to the right
3. Paste the cut data.
4. Move back over to the original position and 1 row down.

That's it. I know, too easy? But I have no idea where to start. If
someone can get me started I can take it from there for the rest of my macro
needs.

Thanks for any help

Steve



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 256
Default Beginner macro programming question

Is this what you want? Will cut the first cell in selection,
regardless of active cell, and move it three columns over.


Public Sub myMacro()
With Selection.Cells(1)
.Cut .Offset(0, 3)
End With
End Sub

On Nov 20, 10:02 am, franciz
wrote:
Hi all,

Using the ActiveCell method will mean that your starting cell need to be in
the current cell position where the data is, what if I want to move the data
but I am
not in my starting cell position.

I think we can use the Range method but not sure how to write the codes
Thanks



"Gary''s Student" wrote:
Actually you can use Cut. For example:


Sub steve()
ActiveCell.Cut
ActiveCell.Offset(0, 3).Select
ActiveSheet.Paste
ActiveCell.Offset(1, -3).Select
End Sub


will do the same thing. This version requires 2 Selects - one to go to the
paste cell and one to get back. Rumor has it that Selects make macros slow.
I don't think it really matters here. Either code will do.
--
Gary''s Student - gsnu200757


"highland" wrote:


Perfect! Thanks.


Side note.. why can't I replace the ".Copy" with ".Cut", thereby removing
the requirement to also perform the ".Clear"?


I tried it and it have no idea what it really did... it definitely didn't
work though :-)


"Gary''s Student" wrote:


How about:


Sub steve2()
With ActiveCell
.Copy .Offset(0, 3)
.Clear
.Offset(1, 0).Select
End With
End Sub
--
Gary''s Student - gsnu200757


"highland" wrote:


Hi, I want to automate a simple task but know nothing about Excel macro
programming. The macro recorder doesn't do what I want so I guess I need to
write something.


I'd like to perform the following steps in a macro:


1. Cut the contents of the current cell
2. Move over 3 columns to the right
3. Paste the cut data.
4. Move back over to the original position and 1 row down.


That's it. I know, too easy? But I have no idea where to start. If
someone can get me started I can take it from there for the rest of my macro
needs.


Thanks for any help


Steve- Hide quoted text -


- Show quoted text -


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Beginner macro programming question

Hi Steve,

ActiveCell.Cut
ActiveCell.Offset(0, 3).Select
ActiveSheet.Paste
ActiveCell.Offset(1, -3).Select

--
Regards,

OssieMac


"highland" wrote:

Hi, I want to automate a simple task but know nothing about Excel macro
programming. The macro recorder doesn't do what I want so I guess I need to
write something.

I'd like to perform the following steps in a macro:

1. Cut the contents of the current cell
2. Move over 3 columns to the right
3. Paste the cut data.
4. Move back over to the original position and 1 row down.

That's it. I know, too easy? But I have no idea where to start. If
someone can get me started I can take it from there for the rest of my macro
needs.

Thanks for any help

Steve

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default Beginner macro programming question

another way:
should be able to do it with 2 lines of code

ActiveCell.Cut Destination:=ActiveCell.Offset(0, 3)
ActiveCell.Offset(1).Select

--


Gary


"highland" wrote in message
...
Hi, I want to automate a simple task but know nothing about Excel macro
programming. The macro recorder doesn't do what I want so I guess I need to
write something.

I'd like to perform the following steps in a macro:

1. Cut the contents of the current cell
2. Move over 3 columns to the right
3. Paste the cut data.
4. Move back over to the original position and 1 row down.

That's it. I know, too easy? But I have no idea where to start. If
someone can get me started I can take it from there for the rest of my macro
needs.

Thanks for any help

Steve



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
Macro Programming Question mtbcpa Excel Discussion (Misc queries) 2 November 26th 07 04:51 PM
Beginner question! Pat Excel Discussion (Misc queries) 3 August 7th 06 09:19 AM
Need help with beginner VB question Tim Whitley[_2_] Excel Programming 0 February 17th 06 04:41 PM
Beginner VBA question light Excel Programming 0 November 10th 04 05:40 PM
Beginner VBA question light Excel Programming 1 November 10th 04 01:44 PM


All times are GMT +1. The time now is 02:36 PM.

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"