ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Insert New Line (https://www.excelbanter.com/excel-discussion-misc-queries/97548-insert-new-line.html)

Clare

Insert New Line
 

Beginner
Hi!
I have a form that enters new information from the user into a
spreadsheet. However, i want a new row added automatically everytime a
new record is added.
Is this possible to add a row using VBA code?
Thanks in advance


--
Clare
------------------------------------------------------------------------
Clare's Profile: http://www.excelforum.com/member.php...o&userid=36047
View this thread: http://www.excelforum.com/showthread...hreadid=558384


Don Guillett

Insert New Line
 
use a worksheet change event that adds the row when the last field in the
current row is filled in.

--
Don Guillett
SalesAid Software

"Clare" wrote in
message ...

Beginner
Hi!
I have a form that enters new information from the user into a
spreadsheet. However, i want a new row added automatically everytime a
new record is added.
Is this possible to add a row using VBA code?
Thanks in advance


--
Clare
------------------------------------------------------------------------
Clare's Profile:
http://www.excelforum.com/member.php...o&userid=36047
View this thread: http://www.excelforum.com/showthread...hreadid=558384




Don Guillett

Insert New Line
 
right click sheet tabview codeinsert thismodify to suit
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column < 6 Then Exit Sub
Rows(Target.Row + 1).Insert
Rows(1).Copy Rows(Target.Row + 1)
End Sub


--
Don Guillett
SalesAid Software

"Don Guillett" wrote in message
...
use a worksheet change event that adds the row when the last field in the
current row is filled in.

--
Don Guillett
SalesAid Software

"Clare" wrote in
message ...

Beginner
Hi!
I have a form that enters new information from the user into a
spreadsheet. However, i want a new row added automatically everytime a
new record is added.
Is this possible to add a row using VBA code?
Thanks in advance


--
Clare
------------------------------------------------------------------------
Clare's Profile:
http://www.excelforum.com/member.php...o&userid=36047
View this thread:
http://www.excelforum.com/showthread...hreadid=558384






Clare

Insert New Line
 

Don
This is the code I have, and i want this to either be added in a new
row (as there is other information below this line) or add a new row
after the form adds the information to the spreadsheet?


Private Sub CommandButton1_Click()

ActiveWorkbook.Sheets("Jobs").Activate

Range("B7").Select

Do

If IsEmpty(ActiveCell) = False Then

ActiveCell.Offset(1, 0).Select

End If

Loop Until IsEmpty(ActiveCell) = True

ActiveCell.Value = Job_No
Range("B7").Select

End Sub


--
Clare
------------------------------------------------------------------------
Clare's Profile: http://www.excelforum.com/member.php...o&userid=36047
View this thread: http://www.excelforum.com/showthread...hreadid=558384


Don Guillett

Insert New Line
 
I'm still not quite sure what you want to do.
Do you want to add a row before or after b7?

Range("b1").End(xlDown).Row+1 'finds next row
cells(rows.count,"b").end(xlup).row+1'finds lastrow +1

--
Don Guillett
SalesAid Software

"Clare" wrote in
message ...

Don
This is the code I have, and i want this to either be added in a new
row (as there is other information below this line) or add a new row
after the form adds the information to the spreadsheet?


Private Sub CommandButton1_Click()

ActiveWorkbook.Sheets("Jobs").Activate

Range("B7").Select

Do

If IsEmpty(ActiveCell) = False Then

ActiveCell.Offset(1, 0).Select

End If

Loop Until IsEmpty(ActiveCell) = True

ActiveCell.Value = Job_No
Range("B7").Select

End Sub


--
Clare
------------------------------------------------------------------------
Clare's Profile:
http://www.excelforum.com/member.php...o&userid=36047
View this thread: http://www.excelforum.com/showthread...hreadid=558384





All times are GMT +1. The time now is 12:31 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com