?
Solved

VBA - SSIS How to remove unwanted rows

Posted on 2014-11-12
3
Medium Priority
?
248 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 52

Accepted Solution

by:
Rgonzo1971 earned 1500 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

801 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