Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
ASU ASU is offline
external usenet poster
 
Posts: 63
Default Autofill formula to next row

I know it's possible......Need to copy formulas in columns (I11:L11), to the
next row using vb code.
This would be done when data is inserted in cells (I11:L11) and carried on
down the page as data is added.
--
ASU
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 427
Default Autofill formula to next row

Sub Macro1()
Range("H11:L11").Select
Selection.Copy
Range("H12").Select
ActiveSheet.Paste
End Sub

  #3   Report Post  
Posted to microsoft.public.excel.misc
ASU ASU is offline
external usenet poster
 
Posts: 63
Default Autofill formula to next row

Thanks you for that.
But how can you make it copy and paste to the next empty row in thodse
columns?
--
ASU


"Dave O" wrote:

Sub Macro1()
Range("H11:L11").Select
Selection.Copy
Range("H12").Select
ActiveSheet.Paste
End Sub


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 427
Default Autofill formula to next row

Sub Macro1()
Dim LastRow As Long
Dim wks As Worksheet
Set wks = Worksheets(ActiveSheet.Name)

'determine first unused row in col H
With wks
LastRow = .Cells(.Rows.Count, "H").End(xlUp).Row +1
End With

Range("H11:L11").Select
Selection.Copy
Range("H" & lastrow).Select
ActiveSheet.Paste
End Sub

  #5   Report Post  
Posted to microsoft.public.excel.misc
ASU ASU is offline
external usenet poster
 
Posts: 63
Default Autofill formula to next row

Thanks very much Dave.
Im sorry to be such a pain. But how can I add your code to the code below.
Iv been trying different ways, with no luck.
I promise then I shall leave you alone!!!

Private Sub CommandButton1_Click()
Dim LastRow As Object

Set LastRow = Sheet1.Range("a65536").End(xlUp)

LastRow.Offset(1, 0).Value = TextBox2.Text
LastRow.Offset(1, 1).Value = TextBox1.Text
LastRow.Offset(1, 2).Value = TextBox8.Text
LastRow.Offset(1, 3).Value = TextBox3.Text
LastRow.Offset(1, 4).Value = TextBox4.Text
LastRow.Offset(1, 5).Value = TextBox5.Text
LastRow.Offset(1, 6).Value = TextBox6.Text
LastRow.Offset(1, 7).Value = TextBox7.Text



MsgBox "One record written to Data Sheet"

response = MsgBox("Do you want to enter another record?", vbYesNo)

If response = vbYes Then
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
TextBox7.Text = ""

TextBox1.SetFocus

Else
Unload Me
End If

End Sub
--
ASU


"Dave O" wrote:

Sub Macro1()
Dim LastRow As Long
Dim wks As Worksheet
Set wks = Worksheets(ActiveSheet.Name)

'determine first unused row in col H
With wks
LastRow = .Cells(.Rows.Count, "H").End(xlUp).Row +1
End With

Range("H11:L11").Select
Selection.Copy
Range("H" & lastrow).Select
ActiveSheet.Paste
End Sub


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
Reusing formula Tony29 Excel Discussion (Misc queries) 7 September 7th 06 03:34 AM
Autofill Formula tqdinh22 Excel Discussion (Misc queries) 1 July 17th 06 10:29 PM
Excel formula for autofill information blitzz008 Excel Discussion (Misc queries) 0 April 20th 06 05:51 PM
Question about Autofill with a formula Corben Excel Discussion (Misc queries) 14 April 16th 06 11:24 AM
"Unable to set the Formula property of the Series class" with a tw PeterQ Charts and Charting in Excel 1 February 15th 06 07:37 PM


All times are GMT +1. The time now is 02:09 AM.

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"