LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc,microsoft.public.excel.programming
Joe Joe is offline
external usenet poster
 
Posts: 476
Default Another 'Copy To The Next Available Row' Question

I have an Excel 2007 spread sheet where I enter information on one sheet, and
the €˜data is stored on a second sheet in the same workbook. The transfer of
data works fine except - in subsequent posts of data, it does not move to the
next available row. It is posting over the first row (after the heading)
every time.

I have read and tryed several of the recommendations posted here, and can
not get them to work.

I know I am close, but it does not work. Please show me what I am doing
wrong in getting this to work correctly.

Below, I am posting the VBA code as well as a link to the XLSM file.

Thank you!

Joe

Sub SaveMyData()
'
' SaveData Macro
' Saves information from Dashboard to Data
'

Dim lastrow As Long
lastrow = Worksheets("Data").Range("O1048576").End(xlUp).Row
nextRow = lastrow + 1

Source_Date = "D6" ' date
Source_State = "H6" ' state
Source_Inquiry_Type = "D8" ' inquiry type
Source_Member_ID = "H8" ' member id
Source_Inquirer_Last_Name = "D10" ' inq last name
Source_Inquirer_First_Name = "H10" ' inq first name
Source_Contact_Name = "L10" ' name of person talking to
Source_Reference_Type = "D14" ' ref type
Source_Reference_ID = "H14" ' ref id
Source_Reference_Last_Name = "D16" ' ref last name
Source_Reference_First_Name = "H16" ' ref first name
Source_Telephone = "D18" ' callback phone number
Source_Reason = "H18" ' reason for the call
Source_Comments = "D22:L23" ' comments block one
Source_Comments2 = "D25:L26" ' comments block two

Destination_Date = "A" ' date
Destination_State = "B" ' state
Destination_Inquiry_Type = "C" ' inquiry type
Destination_Member_ID = "D" ' member id
Destination_Inquirer_Last_Name = "E" ' inq last name
Destination_Inquirer_First_Name = "F" ' inq first name
Destination_Contact_Name = "G" ' name of person talking to
Destination_Reference_Type = "H" ' ref type
Destination_Reference_ID = "I" ' ref id
Destination_Reference_Last_Name = "J" ' ref last name
Destination_Reference_First_Name = "K" ' ref first name
Destination_Telephone = "L" ' callback phone number
Destination_Reason = "M" ' reason for the call
Destination_Comments = "N" ' comments block one
Destination_Comments2 = "O" ' comments block two

' two comment blocks due to 255 character per cell limit

InputRange = Source_Date
NextCol = Destination_Date
Worksheets("Dashboard").Range(Source_Date).Copy
Destination:=Worksheets("Data").Range(NextCol & nextRow)
Worksheets("Dashboard").Range(Source_Date).ClearCo ntents

InputRange = Source_State
NextCol = Destination_State
Worksheets("Dashboard").Range(Source_State).Copy
Destination:=Worksheets("Data").Range(NextCol & nextRow)
Worksheets("Dashboard").Range(Source_State).ClearC ontents

InputRange = Source_Inquiry_Type
NextCol = Destination_Inquiry_Type
Worksheets("Dashboard").Range(Source_Inquiry_Type) .Copy
Destination:=Worksheets("Data").Range(NextCol & nextRow)
Worksheets("Dashboard").Range(Source_Inquiry_Type) .ClearContents

InputRange = Source_Member_ID
NextCol = Destination_Member_ID
Worksheets("Dashboard").Range(Source_Member_ID).Co py
Destination:=Worksheets("Data").Range(NextCol & nextRow)
Worksheets("Dashboard").Range(Source_Member_ID).Cl earContents

InputRange = Source_Inquirer_Last_Name
NextCol = Destination_Inquirer_Last_Name
Worksheets("Dashboard").Range(Source_Inquirer_Last _Name).Copy
Destination:=Worksheets("Data").Range(NextCol & nextRow)
Worksheets("Dashboard").Range(Source_Inquirer_Last _Name).ClearContents

InputRange = Source_Inquirer_First_Name
NextCol = Destination_Inquirer_First_Name
Worksheets("Dashboard").Range(Source_Inquirer_Firs t_Name).Copy
Destination:=Worksheets("Data").Range(NextCol & nextRow)
Worksheets("Dashboard").Range(Source_Inquirer_Firs t_Name).ClearContents

' there are several more lines after this
' this is all I am test for now

End Sub

A link to the file...
http://cid-1cc773911dea3ea1.skydrive...d%5E_TEST.xlsm

 
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
Permanently link Col A edits, inc 'insert row' in multiple workshe Tchipu Excel Worksheet Functions 2 November 10th 09 02:52 PM
'select table row' dmgrant Excel Discussion (Misc queries) 1 July 18th 09 07:21 AM
Pivot Table - filtering 'row' and then hide it ArcticWolf Charts and Charting in Excel 0 November 4th 08 04:31 PM
Another 'IF cell contains THEN color row' Question BeatonD Excel Discussion (Misc queries) 1 January 21st 07 08:30 PM
change row' height chacchet New Users to Excel 2 January 6th 07 11:19 PM


All times are GMT +1. The time now is 11:21 PM.

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"