Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 519
Default Instruct to start in Row 5

Hello from Steved

Please how do I start the below form Row 5, I Thanyou in advance.

Sub Underline4thDigit()
Dim myS As String
Dim myD As Range

For Each myD In Intersect(ActiveSheet.UsedRange, Range("D:D"))
myS = myD.Value
myD.NumberFormat = "@"
myD.Value = myS
With myD.Characters(Start:=4, Length:=1).Font
.FontStyle = "Bold"
.Color = -16776961
.Underline = xlUnderlineStyleSingle
End With
Next myD
End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Instruct to start in Row 5


This should do it for you!


Code:
--------------------
Sub Underline4thDigit()
Dim myS As String
Dim myD As Range

For Each myD In Intersect(ActiveSheet.UsedRange, Range("D5:D" & Range("D" & rows.count).end(xlup).row))
myS = myD.Value
myD.NumberFormat = "@"
myD.Value = myS
With myD.Characters(Start:=4, Length:=1).Font
.FontStyle = "Bold"
.Color = -16776961
.Underline = xlUnderlineStyleSingle
End With
Next myD
End Sub
--------------------


--
The Code Cage Team

Regards,
The Code Cage Team
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
The Code Cage Team's Profile: http://www.thecodecage.com/forumz/member.php?userid=2
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=34744

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Instruct to start in Row 5

Depending on the data content, that code may miss some lines at the
bottom of the data. For example, if the data goes down to row 100 but
the last non-blank element in column D is at 80, rows 81-100 won't be
processed. This may or may not be relevant to the problem at hand.

Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Thu, 27 Nov 2008 20:16:01 +0000, The Code Cage Team
wrote:


This should do it for you!


Code:
--------------------
Sub Underline4thDigit()
Dim myS As String
Dim myD As Range

For Each myD In Intersect(ActiveSheet.UsedRange, Range("D5:D" & Range("D" & rows.count).end(xlup).row))
myS = myD.Value
myD.NumberFormat = "@"
myD.Value = myS
With myD.Characters(Start:=4, Length:=1).Font
.FontStyle = "Bold"
.Color = -16776961
.Underline = xlUnderlineStyleSingle
End With
Next myD
End Sub
--------------------

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 519
Default Instruct to start in Row 5

Hello Chip from Steved

Chip I run the below and it is not underling the 4th Digit also it is not
changing the 4th digit to bold and Red. Yes I inserted it into a module I
also did a view code insert. To my thinking I've forgotten to do something.
Thankyou.


Sub Underline4thDigit()
Dim RR As Range
Dim R As Range
Dim WS As Worksheet
Set WS = ActiveSheet
With WS
Set RR = Application.Intersect(.UsedRange, _
.Range(.Cells(5, "D"), .Cells(.Rows.Count, "D")))
End With

For Each R In RR.Cells
With R.Characters(Start:=4, Length:=1).Font
.FontStyle = "Bold"
.Color = -16776961
.Underline = xlUnderlineStyleSingle
End With
Next R
End Sub





"Chip Pearson" wrote:

Depending on the data content, that code may miss some lines at the
bottom of the data. For example, if the data goes down to row 100 but
the last non-blank element in column D is at 80, rows 81-100 won't be
processed. This may or may not be relevant to the problem at hand.

Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Thu, 27 Nov 2008 20:16:01 +0000, The Code Cage Team
wrote:


This should do it for you!


Code:
--------------------
Sub Underline4thDigit()
Dim myS As String
Dim myD As Range

For Each myD In Intersect(ActiveSheet.UsedRange, Range("D5:D" & Range("D" & rows.count).end(xlup).row))
myS = myD.Value
myD.NumberFormat = "@"
myD.Value = myS
With myD.Characters(Start:=4, Length:=1).Font
.FontStyle = "Bold"
.Color = -16776961
.Underline = xlUnderlineStyleSingle
End With
Next myD
End Sub
--------------------


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 519
Default Instruct to start in Row 5

Hello from Steved

my Fault it does work if it is 2442 but if it is 0042 it cut's of the "00"
how can I avoid this please.


"Steved" wrote:

Hello Chip from Steved

Chip I run the below and it is not underling the 4th Digit also it is not
changing the 4th digit to bold and Red. Yes I inserted it into a module I
also did a view code insert. To my thinking I've forgotten to do something.
Thankyou.


Sub Underline4thDigit()
Dim RR As Range
Dim R As Range
Dim WS As Worksheet
Set WS = ActiveSheet
With WS
Set RR = Application.Intersect(.UsedRange, _
.Range(.Cells(5, "D"), .Cells(.Rows.Count, "D")))
End With

For Each R In RR.Cells
With R.Characters(Start:=4, Length:=1).Font
.FontStyle = "Bold"
.Color = -16776961
.Underline = xlUnderlineStyleSingle
End With
Next R
End Sub





"Chip Pearson" wrote:

Depending on the data content, that code may miss some lines at the
bottom of the data. For example, if the data goes down to row 100 but
the last non-blank element in column D is at 80, rows 81-100 won't be
processed. This may or may not be relevant to the problem at hand.

Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


On Thu, 27 Nov 2008 20:16:01 +0000, The Code Cage Team
wrote:


This should do it for you!


Code:
--------------------
Sub Underline4thDigit()
Dim myS As String
Dim myD As Range

For Each myD In Intersect(ActiveSheet.UsedRange, Range("D5:D" & Range("D" & rows.count).end(xlup).row))
myS = myD.Value
myD.NumberFormat = "@"
myD.Value = myS
With myD.Characters(Start:=4, Length:=1).Font
.FontStyle = "Bold"
.Color = -16776961
.Underline = xlUnderlineStyleSingle
End With
Next myD
End Sub
--------------------




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Instruct to start in Row 5


Chip, naturally you are correct, quite an oversite from me,
thanks for setting me straight.


--
The Code Cage Team

Regards,
The Code Cage Team
'The Code Cage' (http://www.thecodecage.com)
------------------------------------------------------------------------
The Code Cage Team's Profile: http://www.thecodecage.com/forumz/member.php?userid=2
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=34744

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Instruct to start in Row 5

Steved,

Try code like the following

Dim RR As Range
Dim R As Range
Dim WS As Worksheet
Set WS = ActiveSheet
With WS
Set RR = Application.Intersect(.UsedRange, _
.Range(.Cells(5, "D"), .Cells(.Rows.Count, "D")))
End With

For Each R In RR.Cells
' do something
Next R


Cordially,
Chip Pearson
Microsoft MVP
Excel Product Group
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)




On Thu, 27 Nov 2008 12:05:01 -0800, Steved
wrote:

Hello from Steved

Please how do I start the below form Row 5, I Thanyou in advance.

Sub Underline4thDigit()
Dim myS As String
Dim myD As Range

For Each myD In Intersect(ActiveSheet.UsedRange, Range("D:D"))
myS = myD.Value
myD.NumberFormat = "@"
myD.Value = myS
With myD.Characters(Start:=4, Length:=1).Font
.FontStyle = "Bold"
.Color = -16776961
.Underline = xlUnderlineStyleSingle
End With
Next myD
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
start:1 and start:2 - how did i get 2 copies? LuvHaleiwa Excel Discussion (Misc queries) 1 December 21st 07 09:14 PM
Code to instruct "Insert new disk" JakeyC Excel Programming 1 December 17th 06 01:21 PM
start learning Excel/VBA, where to start from? Any online video lectures? cfman Excel Programming 8 September 29th 06 10:40 AM
OT :Start your own online business today !start making dollars [email protected] Excel Discussion (Misc queries) 0 May 6th 06 09:29 PM
Start spreadsheet with WinXP start Gordon Gradwell Excel Worksheet Functions 1 July 13th 05 11:35 AM


All times are GMT +1. The time now is 12:01 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"