PC Review


Reply
Thread Tools Rate Thread

Cut not Copy Appended Data

 
 
Tony S.
Guest
Posts: n/a
 
      1st Apr 2010
In this great Macro, created by Micky (MVP), is there a way to cut and paste
the data from all the columns instead of copy and paste? I just want all the
appended data in Column A".

Sub Tony()
Application.ScreenUpdating = False
LR = ActiveSheet.UsedRange.Rows.Count
LC = ActiveSheet.UsedRange.Columns.Count
Ind = LR + 1
For C = 2 To LC
For R = 1 To LR
If Cells(R, C) <> "" Then
Cells(Ind, 1) = Cells(R, C)
Ind = Ind + 1
End If
Next
Next
Application.ScreenUpdating = True
End Sub

 
Reply With Quote
 
 
 
 
Tony S.
Guest
Posts: n/a
 
      2nd Apr 2010
Great job Paul... that did it.
Thanks!

"Paul" wrote:

>
> If the order the values are pasted into column 1 don't matter (by rows
> instead of by columns), then you can use:
>
>


> Code:
> --------------------
>
>


> Sub Tony()
> Dim Ind As Long, LR As Long, LC As Long
> Application.ScreenUpdating = False
> LR = ActiveSheet.UsedRange.Rows.Count
> LC = ActiveSheet.UsedRange.Columns.Count
> Ind = LR + 1
> For Each ce In Range(Cells(1, 2), Cells(LR, LC))
> If ce.Value <> "" Then
> ce.Cut Cells(Ind, 1)
> Ind = Ind + 1
> End If
> Next ce
> Application.ScreenUpdating = True
> End Sub


> --------------------
>
>
>
> If order matters (need to go down each column, then across), try:
>
>


> Code:
> --------------------
>
>


> Sub Tony2()
> Dim Ind As Long, LR As Long, LC As Long
> Dim C As Long, R As Long
> Application.ScreenUpdating = False
> LR = ActiveSheet.UsedRange.Rows.Count
> LC = ActiveSheet.UsedRange.Columns.Count
> Ind = LR + 1
>
> For C = 2 To LC
> For R = 1 To LR
> If Cells(R, C).Value <> "" Then
> Cells(R, C).Cut Cells(Ind, 1)
> Ind = Ind + 1
> End If
> Next R
> Next C
> Application.ScreenUpdating = True
> End Sub


> --------------------
>
>
> --
> Paul
>
> - Paul
> ------------------------------------------------------------------------
> Paul's Profile: 1697
> View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=192265
>
> http://www.thecodecage.com/forumz
>
> .
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
query does not use data from appended table Rana Microsoft Access Queries 9 7th Jan 2009 07:12 PM
Appended data not being recognized OldGuy Microsoft Access Queries 4 6th Aug 2008 01:50 PM
Parsing the appended data of log file in real time Paulers Microsoft VB .NET 3 13th Jun 2006 07:04 AM
File.Copy \r \n prepended and appended Question needin4mation@gmail.com Microsoft C# .NET 1 14th Sep 2005 06:49 PM
Save form data to appended text file? Trent Shirley Microsoft Outlook Form Programming 1 23rd Oct 2003 09:02 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:14 AM.