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

Hello

I would like to write a "Do Until" macro that will search for the word
"Sub-total" and after finding it. move 7 columns over, then select the next
four cells to the right and apply a certain border to those cells. After
that, I would like that entire row formatted with Bold. I would want to
repeat these steps until it comes to the word Summary.

For example find subtotal (which in this case is in cell B10), then move
over 7 columns to cell I10, select I10:L10, then apply formatting to those
cells. after that select row 10 and apply bold format.

I know this should be easy, but I have never done a looping macro.

Thanks
--
Allan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,522
Default Do Until Macro

I would use a FINDNEXT macro to find all instances. You don't need to look
for "summary"

Sub findsubtotals()
mc = 1 'col A
lr = Cells(Rows.Count, mc).End(xlUp).Row
'With Range("a1:a" & lr)
With Cells(1, mc).Resize(lr)
Set c = .find(What:="subtotal", LookIn:=xlValues, _
LookAt:=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False)

If Not c Is Nothing Then
firstAddress = c.Address
Do
MsgBox c.Row
c.Offset(, 7).Resize(, 4).Borders.LineStyle = xlContinuous
Rows(c.Row).Font.Bold = True

Set c = .FindNext(c)
Loop While Not c Is Nothing _
And c.Address < firstAddress
End If
End With
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Flipper" wrote in message
...
Hello

I would like to write a "Do Until" macro that will search for the word
"Sub-total" and after finding it. move 7 columns over, then select the
next
four cells to the right and apply a certain border to those cells. After
that, I would like that entire row formatted with Bold. I would want to
repeat these steps until it comes to the word Summary.

For example find subtotal (which in this case is in cell B10), then move
over 7 columns to cell I10, select I10:L10, then apply formatting to those
cells. after that select row 10 and apply bold format.

I know this should be easy, but I have never done a looping macro.

Thanks
--
Allan


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default Do Until Macro

What does "mc" mean?
--
Allan


"Don Guillett" wrote:

I would use a FINDNEXT macro to find all instances. You don't need to look
for "summary"

Sub findsubtotals()
mc = 1 'col A
lr = Cells(Rows.Count, mc).End(xlUp).Row
'With Range("a1:a" & lr)
With Cells(1, mc).Resize(lr)
Set c = .find(What:="subtotal", LookIn:=xlValues, _
LookAt:=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False)

If Not c Is Nothing Then
firstAddress = c.Address
Do
MsgBox c.Row
c.Offset(, 7).Resize(, 4).Borders.LineStyle = xlContinuous
Rows(c.Row).Font.Bold = True

Set c = .FindNext(c)
Loop While Not c Is Nothing _
And c.Address < firstAddress
End If
End With
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Flipper" wrote in message
...
Hello

I would like to write a "Do Until" macro that will search for the word
"Sub-total" and after finding it. move 7 columns over, then select the
next
four cells to the right and apply a certain border to those cells. After
that, I would like that entire row formatted with Bold. I would want to
repeat these steps until it comes to the word Summary.

For example find subtotal (which in this case is in cell B10), then move
over 7 columns to cell I10, select I10:L10, then apply formatting to those
cells. after that select row 10 and apply bold format.

I know this should be easy, but I have never done a looping macro.

Thanks
--
Allan


.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,522
Default Do Until Macro

Think about it
mc = 1 'col A


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Flipper" wrote in message
...
What does "mc" mean?
--
Allan


"Don Guillett" wrote:

I would use a FINDNEXT macro to find all instances. You don't need to
look
for "summary"

Sub findsubtotals()
mc = 1 'col A
lr = Cells(Rows.Count, mc).End(xlUp).Row
'With Range("a1:a" & lr)
With Cells(1, mc).Resize(lr)
Set c = .find(What:="subtotal", LookIn:=xlValues, _
LookAt:=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False)

If Not c Is Nothing Then
firstAddress = c.Address
Do
MsgBox c.Row
c.Offset(, 7).Resize(, 4).Borders.LineStyle = xlContinuous
Rows(c.Row).Font.Bold = True

Set c = .FindNext(c)
Loop While Not c Is Nothing _
And c.Address < firstAddress
End If
End With
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Flipper" wrote in message
...
Hello

I would like to write a "Do Until" macro that will search for the word
"Sub-total" and after finding it. move 7 columns over, then select the
next
four cells to the right and apply a certain border to those cells.
After
that, I would like that entire row formatted with Bold. I would want
to
repeat these steps until it comes to the word Summary.

For example find subtotal (which in this case is in cell B10), then
move
over 7 columns to cell I10, select I10:L10, then apply formatting to
those
cells. after that select row 10 and apply bold format.

I know this should be easy, but I have never done a looping macro.

Thanks
--
Allan


.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default Do Until Macro

Sorry to bother, The macro as is doesn't do anything in my workbook and I
just don't understand the language. Would it be possible for you to explain
it to me?

Thanks you
--
Allan


"Flipper" wrote:

What does "mc" mean?
--
Allan


"Don Guillett" wrote:

I would use a FINDNEXT macro to find all instances. You don't need to look
for "summary"

Sub findsubtotals()
mc = 1 'col A
lr = Cells(Rows.Count, mc).End(xlUp).Row
'With Range("a1:a" & lr)
With Cells(1, mc).Resize(lr)
Set c = .find(What:="subtotal", LookIn:=xlValues, _
LookAt:=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False)

If Not c Is Nothing Then
firstAddress = c.Address
Do
MsgBox c.Row
c.Offset(, 7).Resize(, 4).Borders.LineStyle = xlContinuous
Rows(c.Row).Font.Bold = True

Set c = .FindNext(c)
Loop While Not c Is Nothing _
And c.Address < firstAddress
End If
End With
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Flipper" wrote in message
...
Hello

I would like to write a "Do Until" macro that will search for the word
"Sub-total" and after finding it. move 7 columns over, then select the
next
four cells to the right and apply a certain border to those cells. After
that, I would like that entire row formatted with Bold. I would want to
repeat these steps until it comes to the word Summary.

For example find subtotal (which in this case is in cell B10), then move
over 7 columns to cell I10, select I10:L10, then apply formatting to those
cells. after that select row 10 and apply bold format.

I know this should be easy, but I have never done a looping macro.

Thanks
--
Allan


.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 411
Default Do Until Macro

Hi Allen,

I think it means my column.

Dan
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,522
Default Do Until Macro

If desired, send your file to my address below. I will only look if:
1. You send a copy of this message on an inserted sheet
2. You give me the newsgroup and the subject line
3. You send a clear explanation of what you want
4. You send before/after examples and expected results.


--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Flipper" wrote in message
...
Sorry to bother, The macro as is doesn't do anything in my workbook and I
just don't understand the language. Would it be possible for you to
explain
it to me?

Thanks you
--
Allan


"Flipper" wrote:

What does "mc" mean?
--
Allan


"Don Guillett" wrote:

I would use a FINDNEXT macro to find all instances. You don't need to
look
for "summary"

Sub findsubtotals()
mc = 1 'col A
lr = Cells(Rows.Count, mc).End(xlUp).Row
'With Range("a1:a" & lr)
With Cells(1, mc).Resize(lr)
Set c = .find(What:="subtotal", LookIn:=xlValues, _
LookAt:=xlWhole, SearchOrder:=xlByRows, _
SearchDirection:=xlNext, MatchCase:=False)

If Not c Is Nothing Then
firstAddress = c.Address
Do
MsgBox c.Row
c.Offset(, 7).Resize(, 4).Borders.LineStyle = xlContinuous
Rows(c.Row).Font.Bold = True

Set c = .FindNext(c)
Loop While Not c Is Nothing _
And c.Address < firstAddress
End If
End With
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Flipper" wrote in message
...
Hello

I would like to write a "Do Until" macro that will search for the
word
"Sub-total" and after finding it. move 7 columns over, then select
the
next
four cells to the right and apply a certain border to those cells.
After
that, I would like that entire row formatted with Bold. I would want
to
repeat these steps until it comes to the word Summary.

For example find subtotal (which in this case is in cell B10), then
move
over 7 columns to cell I10, select I10:L10, then apply formatting to
those
cells. after that select row 10 and apply bold format.

I know this should be easy, but I have never done a looping macro.

Thanks
--
Allan

.


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
Macro to copy and paste values (columns)I have a macro file built C02C04 Excel Programming 2 May 2nd 08 01:51 PM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
Need syntax for RUNning a Word macro with an argument, called from an Excel macro Steve[_84_] Excel Programming 3 July 6th 06 07:42 PM
macro to delete entire rows when column A is blank ...a quick macro vikram Excel Programming 4 May 3rd 04 08:45 PM
Start Macro / Stop Macro / Restart Macro Pete[_13_] Excel Programming 2 November 21st 03 05:04 PM


All times are GMT +1. The time now is 09:15 AM.

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"