#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15
Default 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   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 5,441
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Inputting data to one worksheet for it effect another daedalus1 Excel Discussion (Misc queries) 1 June 25th 06 04:39 PM
ranking query JaimeTimbrell Excel Discussion (Misc queries) 2 February 16th 06 08:09 AM
Inserting a new line when external data changes Rental Man Excel Discussion (Misc queries) 0 January 11th 06 07:05 PM
Help PLEASE! Not sure what answer is: Match? Index? Other? baz Excel Worksheet Functions 7 September 3rd 05 03:47 PM
Sort pages? David Excel Discussion (Misc queries) 15 May 13th 05 11:33 PM


All times are GMT +1. The time now is 01:37 PM.

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

About Us

"It's about Microsoft Excel"