If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > cut and paste

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-05-06, 10:34
MikeroSoft MikeroSoft is offline
Registered User
 
Join Date: Apr 2006
Posts: 47
cut and paste

i am trying to cut colm a and paste after last colm, i get an error with my code

Dim i As Integer

Range("A:A").Cut

i = ActiveSheet.UsedRange.Columns.Count + 1
Columns(0, i).PasteSpecial xlPasteAll
Reply With Quote
  #2 (permalink)  
Old 07-05-06, 20:56
mkggoh mkggoh is offline
Registered User
 
Join Date: Jun 2006
Posts: 103
Quote:
Originally Posted by MikeroSoft
i am trying to cut colm a and paste after last colm, i get an error with my code

Dim i As Integer

Range("A:A").Cut

i = ActiveSheet.UsedRange.Columns.Count + 1
Columns(0, i).PasteSpecial xlPasteAll
try this:

Quote:
Private Sub cutAndPaste()
Dim i As Integer

Worksheets("Sheet1").Select
ActiveSheet.Range("A:A").Cut
i = ActiveSheet.Range("A1").End(xlToRight).Column
ActiveSheet.Range("A1").Select
ActiveCell.Offset(0, i + 1).Select
ActiveSheet.Paste

End Sub
Hope this helps

Last edited by mkggoh; 07-05-06 at 21:00.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On