Macro to Copy Cell Contents to new Cell Row

L8tely

New Member
Joined
Apr 18, 2012
Messages
6
I've seen several threads here for this function but haven't been able to successfully modify those codes to work in my situation.

I have a form I created on Spreadsheet1 I named M635Frm used to enter data that will stored in a database format on SpreadSheet2 (Named M635Db). I viewd a couple of podcasts that showed how this is done and for the most part the code does fine, but my problem is copying the data to a row on the data entry form so I can move it to the next available row on the database sheet. I originally use a formula in the cells (such as =D2) in the destination cell) which worked until I poasted the data to Spreadsheet2 and the formulas were erased. Now I'm trying some different solutions I've found in the forums but have had no success so far. The current macro I have moves the entire cell and all of its formats:

Sub SetValue_LastRowOffset1()
If Range("D2").Value = "" Then
Range("D2").Value = Range("A200").Value
Else
Range("D" & ActiveSheet.Rows.Count).End(xlUp) _
.Offset(1, 0).Value = Range("A200").Value
End If
End Sub

and the Post Data macro is as follows:

Sub MoveRecord()
Dim WSF As Worksheet ' Form worksheet
Dim WSD As Worksheet ' Data worksheet
Set WSF = Worksheets("M635Frm")
Set WSD = Worksheets("M635Db")
NextRow = WSD.Cells(Rows.Count, 1).End(xlUp).Row + 1
' This next long line is where you copy each of the 20 fields to the database
WSD.Cells(NextRow, 1).Resize(1, 55).Value = Range("A200:BD200") 'Application.Transpose(.Value)
'WSD.Cells(NextRow, 1).Resize(1, 20).Value = Array( _
' Then you would have to clear the cells on the form
WSF.Range("A200:BD200").ClearContents


End Sub

I'm sure I have some errors here too I'm afraid. The form has 55 entries, some from a selection of radio butions and a few text boxes used for comments. The other entries are simple line data, Name, date, etc.. The object is to move the data entries down to a hidden row @ A200 and post the next available blank single row on sheet2. Thanks in advance for your assistance.
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

Forum statistics

Threads
1,214,787
Messages
6,121,565
Members
449,038
Latest member
Guest1337

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top