Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Macro That Tests

I need a macro that tests whether there is text in any cell in column A.
If there is text, I need to bold that cell/cells, and also copy it to column
B. Please let me know how to do this Thanks
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Macro That Tests

Sub jjnotme()
n = Cells(Rows.Count, 1).End(xlUp).Row
For i = 1 To n
With Cells(i, 1)
v = .Value
If Application.WorksheetFunction.IsText(v) Then
.Font.Bold = True
.Copy .Offset(0, 1)
End If
End With
Next
End Sub
--
Gary''s Student - gsnu200772
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Macro That Tests

Right click the sheet tab, view code and paste this in

Sub sonic()
lastrow = Cells(Cells.Rows.Count, "A").End(xlUp).Row
Set myrange = Range("A1:A" & lastrow)
For Each c In myrange
If Application.WorksheetFunction.IsText(c.Value) Then
c.Font.Bold = True
c.Offset(0, 1).Value = c.Value
End If
Next
End Sub

Mike

"jjnotme" wrote:

I need a macro that tests whether there is text in any cell in column A.
If there is text, I need to bold that cell/cells, and also copy it to column
B. Please let me know how to do this Thanks

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Macro That Tests

Sub lookfortext()
mc = "a"
For i = 2 To Cells(Rows.Count, mc).End(xlUp).Row
With Cells(i, mc)
If Not IsNumeric(.Value) Then
'MsgBox i
..Font.Bold = True
..Offset(, 1) = .Value
End If
End With
Next i
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"jjnotme" wrote in message
...
I need a macro that tests whether there is text in any cell in column A.
If there is text, I need to bold that cell/cells, and also copy it to
column
B. Please let me know how to do this Thanks


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro That Tests

This should be relatively fast...

Sub FindBoldAndCopy()
Dim C As Range
Dim R As Range
Dim FirstAddress As String
With ActiveSheet.Range("A:A")
Set C = .Find("*", LookIn:=xlValues)
If Not C Is Nothing Then
FirstAddress = C.Address
Do
If R Is Nothing Then
Set R = C
Else
Set R = Union(R, C)
End If
Set C = .FindNext(C)
Loop While Not C Is Nothing And C.Address < FirstAddress
R.Cells.Font.Bold = True
R.Offset(0, 1).Value = R.Value
End If
End With
End Sub

Rick


"jjnotme" wrote in message
...
I need a macro that tests whether there is text in any cell in column A.
If there is text, I need to bold that cell/cells, and also copy it to
column
B. Please let me know how to do this Thanks




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Macro That Tests

I forgot to mention... if you want the text that you copied into Column B to
be Bold, then add this line...

R.Offset(0, 1).Cells.Font.Bold = True

immediately before the last End If statement in the code I posted in my
previous message.

Rick


"Rick Rothstein (MVP - VB)" wrote in
message ...
This should be relatively fast...

Sub FindBoldAndCopy()
Dim C As Range
Dim R As Range
Dim FirstAddress As String
With ActiveSheet.Range("A:A")
Set C = .Find("*", LookIn:=xlValues)
If Not C Is Nothing Then
FirstAddress = C.Address
Do
If R Is Nothing Then
Set R = C
Else
Set R = Union(R, C)
End If
Set C = .FindNext(C)
Loop While Not C Is Nothing And C.Address < FirstAddress
R.Cells.Font.Bold = True
R.Offset(0, 1).Value = R.Value
End If
End With
End Sub

Rick


"jjnotme" wrote in message
...
I need a macro that tests whether there is text in any cell in column A.
If there is text, I need to bold that cell/cells, and also copy it to
column
B. Please let me know how to do this 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
mutiple tests Mikev Excel Discussion (Misc queries) 2 March 2nd 10 02:20 PM
Last 4 tests Eric Excel Programming 0 February 20th 08 08:28 PM
Tukey HSD tests Edward Excel Worksheet Functions 0 April 25th 07 01:20 PM
Average a group of tests for grade, some tests not taken by all. Scafidel Excel Discussion (Misc queries) 4 August 19th 05 03:50 AM
Nested Looping with Tests, Row Copying Macro Tom Gerber Excel Programming 3 October 16th 03 09:04 PM


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