Unable to export recordset data to multiple excel range in same sheet (1 Viewer)

jay9324

New member
Local time
Today, 23:48
Joined
Feb 12, 2015
Messages
8
Dear Friends,

With below codes I am able to export recordset data to specified excel range
if recordset count is 25. But I am unable to export the data greater than 25 to 2 specified range.

Please Help me guys.. I am stuck in this from last 10 days.

Regards,
JK
 

Attachments

  • Code.txt
    2.2 KB · Views: 105
  • bill.xls
    27 KB · Views: 99

CJ_London

Super Moderator
Staff member
Local time
Today, 19:18
Joined
Feb 19, 2013
Messages
16,601
you code does not match the result - code starts from row 16, example from 2, code opens IN_25, example is IN_82 so I'm not clear where everything starts and finishes

But assuming your specified range is below the first range and you are just skipping a row, you need to increment the value of I by 1 if I=25 to skip row 25

so add this row after the I = I + 1 row

if i=25 then I=I+1

due to the confusion between code and example, it may be that 25 needs to be something else
 

mh123

Registered User.
Local time
Today, 19:18
Joined
Feb 26, 2014
Messages
64
try rstData.Movelast and then a rstData.MoveFirst before your rstData.eof?
 

jay9324

New member
Local time
Today, 23:48
Joined
Feb 12, 2015
Messages
8
Hi CJ_London,

I = 16 is the row number from which data will start pasting in excel sheet. So Example my recordset returning 78 records then:

A16: J59: first 25 records
A70: J107: another 25 records

so on.

This is what I want. Please help..!!!!
 

CJ_London

Super Moderator
Staff member
Local time
Today, 19:18
Joined
Feb 19, 2013
Messages
16,601
This is what I want. Please help..!!!!
I've provided the solution, please read my post and tell me why it doesn't work
 

jay9324

New member
Local time
Today, 23:48
Joined
Feb 12, 2015
Messages
8
Thanks CJ_London,

25 is a Excel sheet name and i = 16 is data print will start from 16th row of excel column.
 

jay9324

New member
Local time
Today, 23:48
Joined
Feb 12, 2015
Messages
8
Hi CJ,

Can you tell how to export to excel and while exporting skip few rows in between.
 

CJ_London

Super Moderator
Staff member
Local time
Today, 19:18
Joined
Feb 19, 2013
Messages
16,601
see my post #2 - modify the code to meet your requirements

if i=25 then I=I+1

change the 25 to the relevant row number, and +1 to +2 or whatever number of rows you want to skip

if you want to repeat this for say rows 50, 75 etc then investigate using the mod function
 

Users who are viewing this thread

Top Bottom