If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > How to append to a work sheet

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-07-07, 17:40
ottomatic ottomatic is offline
Registered User
 
Join Date: Sep 2003
Posts: 228
How to append to a work sheet

Say I have a form with 10 text boxes and I want to right those 10 fields as a new row at the end of an existing sheet...
How would one accomplish this?
Reply With Quote
  #2 (permalink)  
Old 02-08-07, 03:37
MikeTheBike MikeTheBike is offline
Registered User
 
Join Date: Apr 2004
Location: Derbyshire, UK
Posts: 714
Hi again

Shouldn't be too dificult but you need to define 'the end of existing sheet'

ie, will the layout/columns change with time, is the existing sheet always the same one, is it always the currently active sheet etc. ??


MTB
Reply With Quote
  #3 (permalink)  
Old 02-08-07, 12:48
shades shades is offline
Registered User
 
Join Date: Oct 2003
Posts: 1,091
Here is code that will take it from cell values and appends at the end of a list. Perhaps this will give you some ideas.

Code:
Sub PasteList()
Dim LstRow As Integer
Dim myRange As Range
Application.ScreenUpdating = False

    'Copies list of questions below current list (column F)
    Set myRange = Sheets("List").Range("K3:K10")
    myRange.Copy
    Sheets("Work").Range("F65536").End(xlUp).Select
    ActiveCell.Offset(1, 0).Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False
    Application.CutCopyMode = False
    Sheets("Work").Range("G65536").End(xlUp).Select
    ActiveCell.Offset(1, 0).Select
Application.ScreenUpdating = True

End Sub
__________________
old, slow, and confused
but at least I'm inconsistent!

Rich
(retired Excel 2003 user, 3/28/2008)

How to ask a question on forums
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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