A Microsoft Office (Excel, Word) forum. OfficeFrustration

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   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Macro Help



 
 
Thread Tools Display Modes
  #1  
Old March 15th, 2010, 09:45 PM posted to microsoft.public.excel.worksheet.functions
Curtis[_6_]
external usenet poster
 
Posts: 18
Default Macro Help

I am very new to Macro's but am hoping you can simplify your response

I have a sheet that contains certain data types in specific columns

For example

Column A = Date
B= Name
C=Description
D=Cheque#
E= Account # (Debits)
F = Debit amount
G = Account # (Credits)
H= Credit Amount


I need to write a Marco that will look at this source sheet row by row and
transfer the information to a different sheet with predefined columns

Results Sheet

Column D = Account# (from Columns E and G above)
Column E = Amount (from columns F and H above (Note: Debits are positive,
but Credits need to be converted to a negative number)
Column J = Concantenate Column B and C from source sheet
Column K = Cheque #

Hoping you can help

--
ce
  #2  
Old March 16th, 2010, 10:34 AM posted to microsoft.public.excel.worksheet.functions
Jacob Skaria
external usenet poster
 
Posts: 5,952
Default Macro Help

Try

Sub CopyRowstoDiffSheet()

Dim ws1 As Worksheet, ws2 As Worksheet
Dim lngRow As Long, lngTRow As Long

Set ws1 = Sheets("Sheet1")
Set ws2 = Sheets("Sheet2")

For lngRow = 1 To ws1.Cells(Rows.Count, "A").End(xlUp).Row
lngTRow = ws2.Cells(Rows.Count, "A").End(xlUp).Row + 1
ws2.Range("D" & lngTRow) = ws1.Range("E" & lngRow) & _
ws1.Range("G" & lngRow)
ws2.Range("E" & lngTRow) = ws1.Range("F" & lngRow) - _
ws1.Range("H" & lngRow)
ws2.Range("J" & lngTRow) = ws1.Range("B" & lngRow) & " " & _
ws1.Range("C" & lngRow)
ws2.Range("K" & lngTRow) = ws1.Range("D" & lngRow)
Next

End Sub

--
Jacob


"Curtis" wrote:

I am very new to Macro's but am hoping you can simplify your response

I have a sheet that contains certain data types in specific columns

For example

Column A = Date
B= Name
C=Description
D=Cheque#
E= Account # (Debits)
F = Debit amount
G = Account # (Credits)
H= Credit Amount


I need to write a Marco that will look at this source sheet row by row and
transfer the information to a different sheet with predefined columns

Results Sheet

Column D = Account# (from Columns E and G above)
Column E = Amount (from columns F and H above (Note: Debits are positive,
but Credits need to be converted to a negative number)
Column J = Concantenate Column B and C from source sheet
Column K = Cheque #

Hoping you can help

--
ce

 




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


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


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.