Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
importing data
Hi! I am trying to import transaction data to an excel cash report file. I
need the macro to first meet 2 conditions for an account number and that it is not miscellaneous. I got so far. Then, ones it determines that it is a valid transaction, i want it to copy and paste the row with the transaction data from the file to my report excel spreadsheet. However, for some reason, I imports the same row over and over again. I need it to go down the list. Please help. Sub Macro1() ' Macro1 Macro ' Macro recorded 7/25/2006 by sdziamchuk ' Dim cell As Range Dim str As String Windows("experiment cahs trans.csv").Activate For Each cell In Range("a2:a30") If cell = 272244 And cell.Offset(0, 1) < "MISCELLANEOUS" Then ActiveCell.Offset(2, 0).Range("A1:L1").Select Selection.Copy Windows("Book2").Activate ActiveCell.Rows("1:1").EntireRow.Select Selection.Insert Shift:=xlDown ElseIf Not IsEmpty(cell.Value) Then ActiveCell.Offset(1, 0).Activate End If Next cell End Sub -- Sergei D |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
importing data
Sergei,
Try the macro below. HTH, Bernie MS Excel MVP Sub TryNow() Dim Cell As Range Dim str As String Windows("experiment cahs trans.csv").Activate For Each Cell In Range("a2:a30") If Cell.Value = 272244 And Cell.Offset(0, 1).Value < "MISCELLANEOUS" Then Cell.Offset(0, 2).Range("A1:L1").Select Selection.Copy Windows("Book2").Activate ActiveCell.Rows("1:1").EntireRow.Select Selection.Insert Shift:=xlDown Windows("experiment cahs trans.csv").Activate End If Next Cell End Sub "Sergei D" wrote in message ... Hi! I am trying to import transaction data to an excel cash report file. I need the macro to first meet 2 conditions for an account number and that it is not miscellaneous. I got so far. Then, ones it determines that it is a valid transaction, i want it to copy and paste the row with the transaction data from the file to my report excel spreadsheet. However, for some reason, I imports the same row over and over again. I need it to go down the list. Please help. Sub Macro1() ' Macro1 Macro ' Macro recorded 7/25/2006 by sdziamchuk ' Dim cell As Range Dim str As String Windows("experiment cahs trans.csv").Activate For Each cell In Range("a2:a30") If cell = 272244 And cell.Offset(0, 1) < "MISCELLANEOUS" Then ActiveCell.Offset(2, 0).Range("A1:L1").Select Selection.Copy Windows("Book2").Activate ActiveCell.Rows("1:1").EntireRow.Select Selection.Insert Shift:=xlDown ElseIf Not IsEmpty(cell.Value) Then ActiveCell.Offset(1, 0).Activate End If Next cell End Sub -- Sergei D |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Inputting data to one worksheet for it effect another | Excel Discussion (Misc queries) | |||
ranking query | Excel Discussion (Misc queries) | |||
Inserting a new line when external data changes | Excel Discussion (Misc queries) | |||
Help PLEASE! Not sure what answer is: Match? Index? Other? | Excel Worksheet Functions | |||
Sort pages? | Excel Discussion (Misc queries) |