Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Adding new rows with borders


Hi.
I have made a macro which adds new rows before the last row. It all
works fine but I know need the macro to add horizontal dotted lines
every third row.

this is the current code

Code:
--------------------
Sub insRows()
Dim ib As Integer
Dim x As Long, r As Range

ib = Application.InputBox("Enter number of rows to be added", "Add Lines", "5", , , "", , "1")
If ib < False Then


If ib < 1 Then Exit Sub
x = Range("A65536").End(xlUp).Row
Set r = Range("A" & x).Resize(ib)
r.EntireRow.Insert
r.Offset(ib).RowHeight = 12.75
Set r2 = Range(Cells(x, "P"), Cells(x + ib - 1, "P"))
myformula = "=SUM(E" & x & ":M" & x & ")"
r2.Formula = myformula

End If

End Sub

--------------------


I have tried many things but I cannot get just horizontal dotted lines
every third row.

Thank you in advance.


--
Corless
------------------------------------------------------------------------
Corless's Profile: http://www.excelforum.com/member.php...o&userid=26711
View this thread: http://www.excelforum.com/showthread...hreadid=399713

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default Adding new rows with borders

You might be able to adapt the following code, it applies a dotted line
every third row (counting from 1) for the range.

Dim rw As Range
For Each rw In Range("A1:A100")
If rw.Row / 3 - Int(rw.Row / 3) = 0 Then
rw.EntireRow.Borders(xlEdgeBottom).LineStyle = xlDot
End If
Next

--
Cheers
Nigel



"Corless" wrote in
message ...

Hi.
I have made a macro which adds new rows before the last row. It all
works fine but I know need the macro to add horizontal dotted lines
every third row.

this is the current code

Code:
--------------------
Sub insRows()
Dim ib As Integer
Dim x As Long, r As Range

ib = Application.InputBox("Enter number of rows to be added", "Add

Lines", "5", , , "", , "1")
If ib < False Then


If ib < 1 Then Exit Sub
x = Range("A65536").End(xlUp).Row
Set r = Range("A" & x).Resize(ib)
r.EntireRow.Insert
r.Offset(ib).RowHeight = 12.75
Set r2 = Range(Cells(x, "P"), Cells(x + ib - 1, "P"))
myformula = "=SUM(E" & x & ":M" & x & ")"
r2.Formula = myformula

End If

End Sub

--------------------


I have tried many things but I cannot get just horizontal dotted lines
every third row.

Thank you in advance.


--
Corless
------------------------------------------------------------------------
Corless's Profile:

http://www.excelforum.com/member.php...o&userid=26711
View this thread: http://www.excelforum.com/showthread...hreadid=399713



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Adding new rows with borders

or something like this

Sub doborders()
For I = 3 To cells(rows.count,"a").end(xlup).row Step 3
Rows(I).Borders(xlEdgeBottom).LineStyle = xlDot
Next
End Sub

--
Don Guillett
SalesAid Software

"Nigel" wrote in message
...
You might be able to adapt the following code, it applies a dotted line
every third row (counting from 1) for the range.

Dim rw As Range
For Each rw In Range("A1:A100")
If rw.Row / 3 - Int(rw.Row / 3) = 0 Then
rw.EntireRow.Borders(xlEdgeBottom).LineStyle = xlDot
End If
Next

--
Cheers
Nigel



"Corless" wrote in
message ...

Hi.
I have made a macro which adds new rows before the last row. It all
works fine but I know need the macro to add horizontal dotted lines
every third row.

this is the current code

Code:
--------------------
Sub insRows()
Dim ib As Integer
Dim x As Long, r As Range

ib = Application.InputBox("Enter number of rows to be added", "Add

Lines", "5", , , "", , "1")
If ib < False Then


If ib < 1 Then Exit Sub
x = Range("A65536").End(xlUp).Row
Set r = Range("A" & x).Resize(ib)
r.EntireRow.Insert
r.Offset(ib).RowHeight = 12.75
Set r2 = Range(Cells(x, "P"), Cells(x + ib - 1, "P"))
myformula = "=SUM(E" & x & ":M" & x & ")"
r2.Formula = myformula

End If

End Sub

--------------------


I have tried many things but I cannot get just horizontal dotted lines
every third row.

Thank you in advance.


--
Corless
------------------------------------------------------------------------
Corless's Profile:

http://www.excelforum.com/member.php...o&userid=26711
View this thread:

http://www.excelforum.com/showthread...hreadid=399713





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Adding new rows with borders

Hi Don,

How would you adapt this to apply the border only across the columns used
range as well -still keeping with the every third row scenario? (Assuming I
didn't know the last column when the macro was run.)

Thanks in advance!

Patti


"Don Guillett" wrote in message
...
or something like this

Sub doborders()
For I = 3 To cells(rows.count,"a").end(xlup).row Step 3
Rows(I).Borders(xlEdgeBottom).LineStyle = xlDot
Next
End Sub

--
Don Guillett
SalesAid Software

"Nigel" wrote in message
...
You might be able to adapt the following code, it applies a dotted line
every third row (counting from 1) for the range.

Dim rw As Range
For Each rw In Range("A1:A100")
If rw.Row / 3 - Int(rw.Row / 3) = 0 Then
rw.EntireRow.Borders(xlEdgeBottom).LineStyle = xlDot
End If
Next

--
Cheers
Nigel



"Corless" wrote in
message ...

Hi.
I have made a macro which adds new rows before the last row. It all
works fine but I know need the macro to add horizontal dotted lines
every third row.

this is the current code

Code:
--------------------
Sub insRows()
Dim ib As Integer
Dim x As Long, r As Range

ib = Application.InputBox("Enter number of rows to be added", "Add

Lines", "5", , , "", , "1")
If ib < False Then


If ib < 1 Then Exit Sub
x = Range("A65536").End(xlUp).Row
Set r = Range("A" & x).Resize(ib)
r.EntireRow.Insert
r.Offset(ib).RowHeight = 12.75
Set r2 = Range(Cells(x, "P"), Cells(x + ib - 1, "P"))
myformula = "=SUM(E" & x & ":M" & x & ")"
r2.Formula = myformula

End If

End Sub

--------------------


I have tried many things but I cannot get just horizontal dotted lines
every third row.

Thank you in advance.


--
Corless
------------------------------------------------------------------------
Corless's Profile:

http://www.excelforum.com/member.php...o&userid=26711
View this thread:

http://www.excelforum.com/showthread...hreadid=399713







  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Adding new rows with borders

Sub doborders()
Dim icol as Long
Dim i as Long
with ActiveSheet.UsedRange
icol = .columns(.columns.count).Column
End With
For I = 3 To cells(rows.count,"a").end(xlup).row Step 3
cells(i,1).Resize(1,icol).Borders(xlEdgeBottom).Li neStyle = xlDot
Next
End Sub

--
Regards,
Tom Ogilvy

"Patti" wrote in message
...
Hi Don,

How would you adapt this to apply the border only across the columns used
range as well -still keeping with the every third row scenario? (Assuming

I
didn't know the last column when the macro was run.)

Thanks in advance!

Patti


"Don Guillett" wrote in message
...
or something like this

Sub doborders()
For I = 3 To cells(rows.count,"a").end(xlup).row Step 3
Rows(I).Borders(xlEdgeBottom).LineStyle = xlDot
Next
End Sub

--
Don Guillett
SalesAid Software

"Nigel" wrote in message
...
You might be able to adapt the following code, it applies a dotted line
every third row (counting from 1) for the range.

Dim rw As Range
For Each rw In Range("A1:A100")
If rw.Row / 3 - Int(rw.Row / 3) = 0 Then
rw.EntireRow.Borders(xlEdgeBottom).LineStyle = xlDot
End If
Next

--
Cheers
Nigel



"Corless" wrote

in
message ...

Hi.
I have made a macro which adds new rows before the last row. It all
works fine but I know need the macro to add horizontal dotted lines
every third row.

this is the current code

Code:
--------------------
Sub insRows()
Dim ib As Integer
Dim x As Long, r As Range

ib = Application.InputBox("Enter number of rows to be added", "Add
Lines", "5", , , "", , "1")
If ib < False Then


If ib < 1 Then Exit Sub
x = Range("A65536").End(xlUp).Row
Set r = Range("A" & x).Resize(ib)
r.EntireRow.Insert
r.Offset(ib).RowHeight = 12.75
Set r2 = Range(Cells(x, "P"), Cells(x + ib - 1, "P"))
myformula = "=SUM(E" & x & ":M" & x & ")"
r2.Formula = myformula

End If

End Sub

--------------------


I have tried many things but I cannot get just horizontal dotted

lines
every third row.

Thank you in advance.


--
Corless

------------------------------------------------------------------------
Corless's Profile:
http://www.excelforum.com/member.php...o&userid=26711
View this thread:

http://www.excelforum.com/showthread...hreadid=399713











  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Adding new rows with borders

Thanks Tom!

Regards,
Patti

"Tom Ogilvy" wrote in message
...
Sub doborders()
Dim icol as Long
Dim i as Long
with ActiveSheet.UsedRange
icol = .columns(.columns.count).Column
End With
For I = 3 To cells(rows.count,"a").end(xlup).row Step 3
cells(i,1).Resize(1,icol).Borders(xlEdgeBottom).Li neStyle = xlDot
Next
End Sub

--
Regards,
Tom Ogilvy

"Patti" wrote in message
...
Hi Don,

How would you adapt this to apply the border only across the columns used
range as well -still keeping with the every third row scenario?
(Assuming

I
didn't know the last column when the macro was run.)

Thanks in advance!

Patti


"Don Guillett" wrote in message
...
or something like this

Sub doborders()
For I = 3 To cells(rows.count,"a").end(xlup).row Step 3
Rows(I).Borders(xlEdgeBottom).LineStyle = xlDot
Next
End Sub

--
Don Guillett
SalesAid Software

"Nigel" wrote in message
...
You might be able to adapt the following code, it applies a dotted
line
every third row (counting from 1) for the range.

Dim rw As Range
For Each rw In Range("A1:A100")
If rw.Row / 3 - Int(rw.Row / 3) = 0 Then
rw.EntireRow.Borders(xlEdgeBottom).LineStyle = xlDot
End If
Next

--
Cheers
Nigel



"Corless" wrote

in
message ...

Hi.
I have made a macro which adds new rows before the last row. It all
works fine but I know need the macro to add horizontal dotted lines
every third row.

this is the current code

Code:
--------------------
Sub insRows()
Dim ib As Integer
Dim x As Long, r As Range

ib = Application.InputBox("Enter number of rows to be added", "Add
Lines", "5", , , "", , "1")
If ib < False Then


If ib < 1 Then Exit Sub
x = Range("A65536").End(xlUp).Row
Set r = Range("A" & x).Resize(ib)
r.EntireRow.Insert
r.Offset(ib).RowHeight = 12.75
Set r2 = Range(Cells(x, "P"), Cells(x + ib - 1, "P"))
myformula = "=SUM(E" & x & ":M" & x & ")"
r2.Formula = myformula

End If

End Sub

--------------------


I have tried many things but I cannot get just horizontal dotted

lines
every third row.

Thank you in advance.


--
Corless

------------------------------------------------------------------------
Corless's Profile:
http://www.excelforum.com/member.php...o&userid=26711
View this thread:
http://www.excelforum.com/showthread...hreadid=399713











  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Adding new rows with borders


Thanks for the help everyone

--
RICOU
-----------------------------------------------------------------------
RICOUK's Profile: http://www.excelforum.com/member.php...fo&userid=1879
View this thread: http://www.excelforum.com/showthread.php?threadid=39971

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
Innsert a row in microsft excel 2007 - rows without borders PB Excel Discussion (Misc queries) 2 September 29th 09 04:01 PM
Sort rows and move borders with rows [email protected] New Users to Excel 1 June 4th 09 07:36 AM
Hidden rows in worksheet also hide borders Gavelle Excel Discussion (Misc queries) 6 December 5th 08 09:42 PM
Adding row without borders Josh W Excel Discussion (Misc queries) 6 June 26th 08 03:44 AM
Adding Borders Wayne Excel Worksheet Functions 2 June 15th 05 01:32 AM


All times are GMT +1. The time now is 02:30 PM.

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

About Us

"It's about Microsoft Excel"