Computing.Net > Forums > Office Software > Excel Macro

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Excel Macro

Reply to Message Icon

Name: Toby
Date: November 7, 2005 at 06:49:36 Pacific
OS: Win XP Prof.
CPU/Ram: Pent. 3
Comment:

Hi,

I want to create a Macro in Excel which is able to copy the content from one sheet to another. But it's a little bit tricky: On one sheet the data is in row and should be copied to the other sheet in columns. Example: Sheet1 A4 to sheet2 A1
then sheet1 A5 to sheet2 B1 an so on.
I do not know how to write the do until command for this in VBA. Could anybody help me?

Thanks Toby



Sponsored Link
Ads by Google

Response Number 1
Name: Bryco
Date: November 7, 2005 at 11:05:06 Pacific
Reply:

Row to Columns is Paste Special, Transpose.

HTH
Bryan


0

Response Number 2
Name: rhawk7938
Date: November 7, 2005 at 11:54:47 Pacific
Reply:

If you said what part of using do until you don't understand it might be easier to help.

To end the loop you could use "isempty" or just if the Cells()="" Exit Do .

To move through the cells use offset().


0

Response Number 3
Name: dtech10
Date: November 7, 2005 at 15:39:24 Pacific
Reply:

Hi
Select the cell in Col 1 Sheet1 and rum this Macro.

Option Explicit
Sub Macro1()
Dim Row%, xCol%, xRow%, Col%, Max%

Col% = ActiveCell.Column
Row% = ActiveCell.Row
xRow% = Row%
xCol% = 1
Max% = Selection.Count

Do
If Cells(Row%, Col%) <> "" Then
Sheet2.Cells(1, xCol%) = Cells(Row%, Col%)
End If
Row% = Row% + 1
xCol% = xCol% + 1
Loop Until xCol% > Max%
End Sub


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Spell check in Italian MS... Outlook not logging in



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Office Software Forum Home


Sponsored links

Ads by Google


Results for: Excel Macro

Run Excel Macro as Automated Task on Server www.computing.net/answers/office/run-excel-macro-as-automated-task-on-server/9661.html

Excel Macro read and process CSV www.computing.net/answers/office/excel-macro-read-and-process-csv/3820.html

Excel macro www.computing.net/answers/office/excel-macro/4051.html