Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default format last 20 rows

I've got a very long spreadsheet that I copy information to every day. I
would like to format the text that is copied over via a range command to be
formatted like the existing text in the document which would mean I need to
change the following charactristics
.HorizontalAlignment = xlLeft
Selection.Font.ColorIndex = 0
Selection.Font.Bold = False

Is there a way, since this speadsheet has over 50,000 rows to just designate
the last 30 cells in col B have the above format?

Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default format last 20 rows

MyLastRow = Cells(1, 1).CurrentRegion.Rows.Count
With Rows(CStr(MyLastRow - 19) & ":" & CStr(MyLastRow))
.HorizontalAlignment = xlLeft
.Font.ColorIndex = 0
.Font.Bold = False
End With

Vlado

"JOUIOUI" wrote:

I've got a very long spreadsheet that I copy information to every day. I
would like to format the text that is copied over via a range command to be
formatted like the existing text in the document which would mean I need to
change the following charactristics
.HorizontalAlignment = xlLeft
Selection.Font.ColorIndex = 0
Selection.Font.Bold = False

Is there a way, since this speadsheet has over 50,000 rows to just designate
the last 30 cells in col B have the above format?

Thanks

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default format last 20 rows

here's one way

Sub test()
Dim lastrow As Long
lastrow = Cells(Rows.Count, "B").End(xlUp).Row - 19

With Range("b" & lastrow).Resize(20, 1)
.HorizontalAlignment = xlLeft
.Font.ColorIndex = 0
.Font.Bold = False
End With
End Sub

--


Gary


"JOUIOUI" wrote in message
...
I've got a very long spreadsheet that I copy information to every day. I
would like to format the text that is copied over via a range command to be
formatted like the existing text in the document which would mean I need to
change the following charactristics
.HorizontalAlignment = xlLeft
Selection.Font.ColorIndex = 0
Selection.Font.Bold = False

Is there a way, since this speadsheet has over 50,000 rows to just designate
the last 30 cells in col B have the above format?

Thanks



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
Format new rows. Fellow[_2_] Excel Discussion (Misc queries) 2 February 5th 10 03:26 AM
Format Rows dhstein Excel Discussion (Misc queries) 0 January 27th 10 02:03 AM
format new rows Fellow[_2_] Excel Discussion (Misc queries) 2 December 14th 09 10:50 PM
Enabling option „Format rows“ to hide/unhide rows using VBA-code? ran58 Excel Discussion (Misc queries) 0 July 28th 09 03:46 PM
Format rows FDA Excel Discussion (Misc queries) 8 April 15th 08 11:20 PM


All times are GMT +1. The time now is 09:16 PM.

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"