Solved

VBA - SSIS How to remove unwanted rows

Posted on 2014-11-12
3
217 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
  • 2
3 Comments
 
LVL 49

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

A little background as to how I came to I design this code: Around 5 years ago I designed an add-in that formatted Excel files to a corporate standard, applying different cell colours and font type depending on whether the cells contained inputs,…
Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

919 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now