Copy formulas down (one is an array) using user form

XfortunaX

New Member
Joined
Aug 28, 2014
Messages
28
Hi,
I am looking to copy 4 cells of formulas down one row. One of the formulas is an array. What I came up with copies the formulas down but they still reference the cell from the line above.
I would like to add a border to the active row B:H at the end.
<code style="font-family: "Courier New", courier, monospace; margin: 0px 2px; padding: 15px; border: 0px; background-color: transparent; border-radius: 2px; word-break: normal; display: block; font-size: 1em; line-height: 16px; overflow: auto;">Private Sub cmdOk_Click()

Dim RowNum As Long

RowNum = Range("B8").End(xlDown).Offset(1, 0).Row

Cells(RowNum, 2).Value = TxtEmployeeID
Cells(RowNum, 3).Value = txtLastname & "," & " " & txtFirstname
Cells(RowNum, 4).Value = CDate(dtpDate)

Unload Me

Cells(RowNum, 5).FormulaArray = Cells(RowNum - 1, 5).FormulaArray
Cells(RowNum, 6).Formula = Cells(RowNum - 1, 6).Formula
Cells(RowNum, 7).Formula = Cells(RowNum - 1, 7).Formula
Cells(RowNum, 8).Formula = Cells(RowNum - 1, 8).Formula


End Sub
</code>Any help would be greatly appreciated.
Thank you,
JT
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
JT,

Try...

Code:
RowNum = Range("B8").End(xlDown).Offset(1, 0).Row

Cells(RowNum, 2).Value = TxtEmployeeID
Cells(RowNum, 3).Value = txtLastname & "," & " " & txtFirstname
Cells(RowNum, 4).Value = CDate(dtpDate)


Unload Me


Range(Cells(RowNum - 1, 5), Cells(RowNum, 8)).FillDown
Range(Cells(RowNum - 1, 2), Cells(RowNum - 1, 8)).Borders.LineStyle = xlNone
Range(Cells(RowNum, 2), Cells(RowNum, 8)).Borders.LineStyle = xlContinuous

Hope that helps.
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,262
Members
452,627
Latest member
KitkatToby

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