ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to copy cell from one worksheet to another (https://www.excelbanter.com/excel-programming/320102-macro-copy-cell-one-worksheet-another.html)

allanb

Macro to copy cell from one worksheet to another
 
Hi I currently have a workbook that contains two worksheets 'results' and
'data'

The information currently runs in two rows across the page a1, b1, c1, d1,
e1 etc. needs to become a1, a2, a3, a4, a5

and a2, b2, c2, d2, e2, needs to become b1, b2, b3, b4, b5 etc.

Any suggestions on the easiest way to do this?

Cheers,

Allan

Claud Balls

Macro to copy cell from one worksheet to another
 
Option Explicit
Sub Macro1()
Dim iNumRows As Integer, iNumCol As Integer, r As Integer, c As Integer
iNumRows = Sheets("data").UsedRange.Rows.Count
iNumCol = Sheets("data").UsedRange.Columns.Count
For r = 1 To iNumRows
For c = 1 To iNumCol
Sheets("result").Cells(c, r) = Sheets("data").Cells(r, c)
Next
Next

End Sub

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

BuZzzy FF

Macro to copy cell from one worksheet to another
 
Hello,

I think you can do this via a Paste function with the Transpose
indication = True.

I have recorded a small macro which does this job.

Sheets("Sheet1").Select
Range("A1:C3").Select
Selection.Copy
Sheets("Sheet2").Select
Selection.PasteSpecial Paste:=xlPasteAll, peration:=xlNone, SkipBlanks:=
False, Transpose:=True

kind regards,

Filip Henderieckx

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

allanb

Macro to copy cell from one worksheet to another
 
Ta guys, both really helped me out of a sticky situation.

Cheers,

Allan

"allanb" wrote:

Hi I currently have a workbook that contains two worksheets 'results' and
'data'

The information currently runs in two rows across the page a1, b1, c1, d1,
e1 etc. needs to become a1, a2, a3, a4, a5

and a2, b2, c2, d2, e2, needs to become b1, b2, b3, b4, b5 etc.

Any suggestions on the easiest way to do this?

Cheers,

Allan



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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com