![]() |
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 |
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 |
All times are GMT +1. The time now is 12:47 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com