#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 38
Default Macro to add data

I want a macro to carry my information from a form into a spreadsheet. The
data needs to go into the first line of the spreadsheet each time new data is
entered on the form. In the spreadsheet itself, I need to add a row, moving
existing data into the rows below, and add whatever new data id obtained from
the form. Once that is done, I need to clear the form.
--
Arlene
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,942
Default Macro to add data

hi
assuming that you are using a standard userform from the vb editor......
you will need a line like this for each of your controls that you have
entered data into and want that data to go to the sheet.

Range("A65000").End(xlUp).Offset(1, 0).Value = TextBox1.Value

then to clear the form you would need a line like this for each control to
clear the control......

TextBox1.Value = ""

i assume that all these lines would go into a commandbutton_click event.

post back if questions.

Regards
FSt1
"Arlene" wrote:

I want a macro to carry my information from a form into a spreadsheet. The
data needs to go into the first line of the spreadsheet each time new data is
entered on the form. In the spreadsheet itself, I need to add a row, moving
existing data into the rows below, and add whatever new data id obtained from
the form. Once that is done, I need to clear the form.
--
Arlene

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,942
Default Macro to add data

forgot to add
adjust the range for each line of code to the column you want the data to go
into.

regards
FSt1

"FSt1" wrote:

hi
assuming that you are using a standard userform from the vb editor......
you will need a line like this for each of your controls that you have
entered data into and want that data to go to the sheet.

Range("A65000").End(xlUp).Offset(1, 0).Value = TextBox1.Value

then to clear the form you would need a line like this for each control to
clear the control......

TextBox1.Value = ""

i assume that all these lines would go into a commandbutton_click event.

post back if questions.

Regards
FSt1
"Arlene" wrote:

I want a macro to carry my information from a form into a spreadsheet. The
data needs to go into the first line of the spreadsheet each time new data is
entered on the form. In the spreadsheet itself, I need to add a row, moving
existing data into the rows below, and add whatever new data id obtained from
the form. Once that is done, I need to clear the form.
--
Arlene

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 38
Default Macro to add data

This is the code that I have and what happens is that the top row is
replaced, not copied down

Sub AddRecord()
'
' AddRecord Macro
'
' Keyboard Shortcut: Ctrl+Shift+R
'
Selection.EntireRow.Insert , CopyOrigin:=xlFormatFromLeftOrAbove
ActiveCell.Offset(-1, 0).Range("A1:G1").Select
Selection.Copy
Application.Goto Reference:="Bottom"
ActiveCell.Offset(-1, 0).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Sheets("Sheet1").Select
End Sub

--
Arlene


"FSt1" wrote:

forgot to add
adjust the range for each line of code to the column you want the data to go
into.

regards
FSt1

"FSt1" wrote:

hi
assuming that you are using a standard userform from the vb editor......
you will need a line like this for each of your controls that you have
entered data into and want that data to go to the sheet.

Range("A65000").End(xlUp).Offset(1, 0).Value = TextBox1.Value

then to clear the form you would need a line like this for each control to
clear the control......

TextBox1.Value = ""

i assume that all these lines would go into a commandbutton_click event.

post back if questions.

Regards
FSt1
"Arlene" wrote:

I want a macro to carry my information from a form into a spreadsheet. The
data needs to go into the first line of the spreadsheet each time new data is
entered on the form. In the spreadsheet itself, I need to add a row, moving
existing data into the rows below, and add whatever new data id obtained from
the form. Once that is done, I need to clear the form.
--
Arlene

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
Excel OLE data in PPT reverting to OLD data after macro updation Hari Prasadh Charts and Charting in Excel 12 August 4th 05 04:46 PM
Macro to move data to different column based on data in another co malycom Excel Discussion (Misc queries) 3 August 2nd 05 07:07 PM
is it possible to execute write to the fields in another .xsl form a macro in another .xsl? e.g. some way to load another .xsl into an .xsl macro and write to its data? Daniel Excel Worksheet Functions 1 June 23rd 05 11:38 PM
enter data in cell which will start macro to move data to sheet2 Tommy Excel Discussion (Misc queries) 0 May 12th 05 05:00 PM
Using a MACRO to sort data BAM718 Excel Worksheet Functions 5 April 16th 05 01:40 PM


All times are GMT +1. The time now is 03:54 PM.

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

About Us

"It's about Microsoft Excel"