Solved

VBA - SSIS How to remove unwanted rows

Posted on 2014-11-12
3
241 Views
Last Modified: 2014-11-14
I am using SSIS to populate a table from excel. The issue is, at the bottom of the excel sheet there’s some summary information that is not needed and in a different structure to the rest of the spreadsheet, as a result of this when I run my package I get an error.

I have tried creating a script component but can quite get it to work.

The rows are not static. This week I had 1543 rows last week I had 987 rows.

Correct Structure.

ABC123456      21/10/2014      Text      Text      1       32      15/12/2014      7677787      1

Everything after here can be deleted.

Then there is a blank row.
Then 4 columns
‘Type’      ‘Events      Exams’      ‘Text’      ‘Text’
A      10            10      0

Again the row count changes each week.

Then this is repeated two more times with slightly different columns and fields.

What I am trying to do is delete everything  after my first set of data.


Thanks
0
Comment
Question by:aneilg
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 51

Accepted Solution

by:
Rgonzo1971 earned 500 total points
ID: 40437205
Hi,

pls try

Sub Macro()
RowAfterFirstBlankRow = Range("A1").End(xlDown).End(xlDown).Row
Set myRange = Range(Range("A" & RowAfterFirstBlankRow), _
        Range("A" & Cells.Rows.Count).End(xlUp))
myRange.EntireRow.Delete
End Sub

Open in new window

Regards
0
 

Author Comment

by:aneilg
ID: 40439907
thanks i'll try it later today.
0
 

Author Comment

by:aneilg
ID: 40442139
works fine thanks.


i now need to do the same with another file but with c# code.
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question