Solved

VBA - SSIS How to remove unwanted rows

Posted on 2014-11-12
3
213 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 48

Accepted Solution

by:
Rgonzo1971 earned 500 total points
Comment Utility
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
Comment Utility
thanks i'll try it later today.
0
 

Author Comment

by:aneilg
Comment Utility
works fine thanks.


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

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…

763 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

11 Experts available now in Live!

Get 1:1 Help Now