ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help to write a macro..... (https://www.excelbanter.com/excel-programming/382978-help-write-macro.html)

kiran

Help to write a macro.....
 
Hi All,
I have 2 excel workbook Register.xls & Update.xls my query is every day i
enter the data in Register.xls as follows

SlNo Module Submodule Date Type Status
1 Mfg FAS 01/02/07 Enh Out
2 Dis Aviance 10/02/07 Enh out
3 Mfg FAS 10/02/07 Enh In
4 Fin SEGA 11/01/07 Bug In

now i want to copy the row to Update.xls where the Status is "OUT" can any
one help me to write a macro for this

TIA

Tom Ogilvy

Help to write a macro.....
 
check out the code samples he

http://www.rondebruin.nl/copy5.htm

--
Regards,
Tom Ogilvy


"kiran" wrote in message
...
Hi All,
I have 2 excel workbook Register.xls & Update.xls my query is every day i
enter the data in Register.xls as follows

SlNo Module Submodule Date Type Status
1 Mfg FAS 01/02/07 Enh Out
2 Dis Aviance 10/02/07 Enh out
3 Mfg FAS 10/02/07 Enh In
4 Fin SEGA 11/01/07 Bug In

now i want to copy the row to Update.xls where the Status is "OUT" can any
one help me to write a macro for this

TIA




[email protected]

Help to write a macro.....
 
On Feb 10, 11:44 pm, kiran wrote:
Hi All,
I have 2 excel workbook Register.xls & Update.xls my query is every day i
enter the data in Register.xls as follows

SlNo Module Submodule Date Type Status
1 Mfg FAS 01/02/07 Enh Out
2 Dis Aviance 10/02/07 Enh out
3 Mfg FAS 10/02/07 Enh In
4 Fin SEGA 11/01/07 Bug In

now i want to copy the row to Update.xls where the Status is "OUT" can any
one help me to write a macro for this

TIA


Hello there,
I am new at this VBA stuff, but what I created does work. There may
be a better way to do it, but until I learn more, use this.
Gary
Sub RtoUCopy()
Dim Var1 As Variant
Dim Var2 As Variant
Dim Var3 As Variant
Dim Var4 As Variant
Dim Var5 As Variant
Dim Var6 As Variant
Dim RowR As Integer
Dim RowU As Integer

' Both workbooks need to be open first. Cell A2 must be start
of data.
RowR = 2
RowU = 2
Application.Workbooks("Register.xls").Worksheets(1 ).Activate
Do While Not IsEmpty(Cells(RowR, 1))
Var6 = Cells(RowR, 6)
If LCase(Var6) = "out" Then
Var1 = Cells(RowR, 1)
Var2 = Cells(RowR, 2)
Var3 = Cells(RowR, 3)
Var4 = Cells(RowR, 4)
Var5 = Cells(RowR, 5)
Application.Workbooks("Update.xls").Worksheets(1). Activate
Cells(RowU, 1) = Var1
Cells(RowU, 2) = Var2
Cells(RowU, 3) = Var3
Cells(RowU, 4) = Var4
Cells(RowU, 5) = Var5
Cells(RowU, 6) = Var6
RowU = RowU + 1

Application.Workbooks("Register.xls").Worksheets(1 ).Activate
End If
RowR = RowR + 1
Loop
End Sub





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

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