Advertisement

05.09.2008 at 09:14AM PDT, ID: 23389952 | Points: 500
[x]
Attachment Details
Export data from one Excel sheet to another, with some basic manipulation
Tags: Microsoft, Excel, 2003
Hello experts,
I have an Excel 2003 workbook, containing several worksheets ('workbook A').
I want to produce a second and separate worbook ('workbook B') with a worksheet containing data derived from one of the sheets in A - though some of the data will need to be modified in the transfer

I was just wondering if someone could recommend an approach please.  This is a task that will have to be done repeatedly by an admin user.  Ideally I'd do it as an excel macro so that it can be put behind a 'Create Derived Sheet' button or whatever, and can easily be distributed with the original workbook.  But I'm a newbie to macros so dont know if possible.  Once I'm on the right lines I'll be fine, but just having a clear idea of a sensible and proven approach is eluding me currently.  Need to get this sorted, hence points.
Start your free trial to view this solution
Question Stats
Zone: Software
Question Asked By: seashell1
Question Asked On: 05.09.2008
Participating Experts: 1
Points: 500
Views: 0
Translate:
Loading Advertisement...
05.09.2008 at 09:28AM PDT, ID: 21534432

Rank: Master

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.09.2008 at 09:37AM PDT, ID: 21534514

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.09.2008 at 09:46AM PDT, ID: 21534602

Rank: Master

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.09.2008 at 09:52AM PDT, ID: 21534658

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
05.09.2008 at 10:05AM PDT, ID: 21534751

Rank: Master

All comments and solutions are available to Premium Service Members only.

Start your 7 day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Handhelds / PDAs
  • Displays / Monitors
  • Components
  • Networking Hardware
  • Peripherals
  • Laptops/Notebooks
  • Storage
  • Servers
  • Desktops
  • New Users
  • Misc
  • Apple
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMWare
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMWare
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Community Advisor
  • Lounge
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • Community Advisor
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
05.09.2008 at 09:28AM PDT, ID: 21534432

Rank: Master

The easiest way to get started is to record a macro (Tools\Macro\Record Macro). After you've started recording, perform the steps you need and the macro will write itself. Stop recording when you're done and go to the Visual Basic Editor (Alt+F11) to see your code. If you have any questions on the code or it doesn't do exactly what you want it to do, keep posting, EE is the place for you.

Good luck,

Thomas
 
05.09.2008 at 09:37AM PDT, ID: 21534514
thanks Thomas.  Maybe I should add some more info.  The source sheet has various columns one of which is a month.  I need to be able to prompt the user to specify the month they are interested in, select all the records in the source sheet that are for that month, create a new sheet (preferably in a new workbook), and write (with some transformation) the appropriate records from the source sheet into the new worksheet. Depending on the content of a given record, I need to actually write 2 or more records into the new sheet which give extra info based on some hard-code business rules for a client. Does a macro still cound the way to go?  Does it support user-supplied parameters?
Thanks in advance
 
05.09.2008 at 09:46AM PDT, ID: 21534602

Rank: Master

A macro is definitely the way to go, and it does support parameters. However, macro recording doesn't take well to that, meaning that you would first have to record the macro with a fixed input (March 08) for instance, and then convert that into a parameter.

Ideally, with your month being a parameter, I would add a sheet from which to launch the macro, with a drop down box with the choice of month. Do an autofilter with the month as the criteria, copy the filtered data in a new worksheet. For the business rules, where are they stored and how do you pick them?
 
05.09.2008 at 09:52AM PDT, ID: 21534658
the business rules are pretty simple and can be totally hard coded.  The user doesnt need to know them, and the same rules apply to each record every time  Essentially, for a given record if a given column contains one value, then I need to write row X into the new sheet, if it contains another value, then I write row X and row Y.  I will look into applying your advice- thanks
 
05.09.2008 at 10:05AM PDT, ID: 21534751

Rank: Master

Then additional advice.

Do the autofilter, copy the data, then do a loop on the data to add your business rules. Something like:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
Dim lastRow As Long
 
With ActiveSheet
lastRow = .range("A1").CurrentRegion.Rows.Count
 
    For i = 0 To lastRow - 1
        If .Cells(lastRow - i, 1).Value = 2 Then
           Rows(lastRow - i + 1).Insert
           Cells(lastRow - i + 1, 1).Value = 3
        End If
    Next
End With
Open in New Window
 
 
20080236-EE-VQP-29 / EE_QW_2_20070628