Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Macro adding line

I need to create a macro that runs a SQL query and assigns the output to the
next row in the report. The report is additive, new data is always added to
the next available row. How do you assign the SQL output to the next row?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 595
Default Macro adding line

On Tue, 20 Mar 2007 07:52:05 -0700, rick_mc
wrote:

I need to create a macro that runs a SQL query and assigns the output to the
next row in the report. The report is additive, new data is always added to
the next available row. How do you assign the SQL output to the next row?


Something like this:

Dim rng As Range
Dim rs As ADODB.Recordset

Set rng = Sheet1.Cells(Sheet1.Rows.Count, 1).End(xlUp).Offset(1, 0)
'Get recordset here

rng.CopyFromRecordset rs
--
Dick Kusleika
Microsoft MVP-Excel
http://www.dailydoseofexcel.com
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem adding vertical marker line to line chart lbb Charts and Charting in Excel 6 January 9th 09 09:02 AM
macro from columns to rows but adding every time a new line [email protected] Excel Discussion (Misc queries) 2 December 7th 08 08:59 PM
Run macro when adding a new line S. G.[_2_] Excel Programming 1 January 3rd 07 07:46 AM
Chart Type - Line Column adding a 2nd line [email protected] Charts and Charting in Excel 1 October 24th 06 04:17 PM
adding a line at the end of a macro to name the cell yippy Excel Programming 2 January 3rd 04 02:15 AM


All times are GMT +1. The time now is 10:17 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"