Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
Hi,
 
I am having a problem with the following.
 
I am trying to
 
1. create 2 excel worksheets....able to do this
2. Add a heading (which are the same) on both worksheets e.g. Name, Address
3. Select a worksheet and populate with an array
4. When the records populated are greater than 20,000 then select worksheet 2 to populate the rest
 
I can do this no bother when just the one worksheet but seem to have got myself all confused when trying the above.
Posted 8-Apr-13 2:25am

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Im assuming that you have some sort of code as this:
Dim oXL As Excel.Application
        Dim oWB As Excel.Workbook
        Dim oSheet As Excel.Worksheet
        Dim oRng As Excel.Range
 
        ' Start Excel and get Application object.
        oXL = CreateObject("Excel.Application")
        oXL.Visible = True
 
        ' Get a new workbook.
        oWB = oXL.Workbooks.Add
        oSheet = oWB.ActiveSheet
 
You can set the first sheet with the command:
oSheet = oWB.Sheet(1)
and the second by:
oSheet = oWB.Sheet(2)
  Permalink  
Comments
Central_IT at 8-Apr-13 7:50am
   
Thanks for getting back with a quick reply.
Your solution works perfect. Just a wee question,
How can you in a loop display the headings and then the data?
Kenneth Haugland at 8-Apr-13 7:53am
   
Just loop through the cells and read the header information?
Please see this:
http://support.microsoft.com/kb/301982
Central_IT at 8-Apr-13 8:42am
   
Thanks yet again for the required information. There is enough info there to solve my problem.
Central_IT at 8-Apr-13 8:43am
   
Should have been 5 stars but not allowing me over 4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 7,903
1 Sergey Alexandrovich Kryukov 7,142
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,820


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 8 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100