Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Simple VB Script - Part 2

Ok, I figured our how to do my indenting per line,

Range("A23:I23").Select
Selection.InsertIndent (ActiveCell.Value)
Range("A24:I24").Select
Selection.InsertIndent (ActiveCell.Value)
Range("A25:I25").Select
Selection.InsertIndent (ActiveCell.Value)
Range("A26:I26").Select
Selection.InsertIndent (ActiveCell.Value)

Is there a way to simplify the code to check row 1 for a
value, if there is a value then perform the indent. Move
to the next line and perform the operation until it comes
to a blank row, then it stops?

Sorry for the newbie questions,

Thanks,
Graeme
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Simple VB Script - Part 2

Graeme,

Try This

For i = 25 to Cells(Rows.Count,"A").End(xlUp).Row
If Range("A" & i).Value <"" Then
Range("A" & i & ":I" & i).InsertIndent Range("A" & i).Value
End If
Next i

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Graeme" wrote in message
...
Ok, I figured our how to do my indenting per line,

Range("A23:I23").Select
Selection.InsertIndent (ActiveCell.Value)
Range("A24:I24").Select
Selection.InsertIndent (ActiveCell.Value)
Range("A25:I25").Select
Selection.InsertIndent (ActiveCell.Value)
Range("A26:I26").Select
Selection.InsertIndent (ActiveCell.Value)

Is there a way to simplify the code to check row 1 for a
value, if there is a value then perform the indent. Move
to the next line and perform the operation until it comes
to a blank row, then it stops?

Sorry for the newbie questions,

Thanks,
Graeme



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Simple VB Script - Part 2

Thanks Bob!

That works perfect!

Graeme


-----Original Message-----
Graeme,

Try This

For i = 25 to Cells(Rows.Count,"A").End(xlUp).Row
If Range("A" & i).Value <"" Then
Range("A" & i & ":I" & i).InsertIndent Range

("A" & i).Value
End If
Next i

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Graeme" wrote in

message
...
Ok, I figured our how to do my indenting per line,

Range("A23:I23").Select
Selection.InsertIndent (ActiveCell.Value)
Range("A24:I24").Select
Selection.InsertIndent (ActiveCell.Value)
Range("A25:I25").Select
Selection.InsertIndent (ActiveCell.Value)
Range("A26:I26").Select
Selection.InsertIndent (ActiveCell.Value)

Is there a way to simplify the code to check row 1 for

a
value, if there is a value then perform the indent.

Move
to the next line and perform the operation until it

comes
to a blank row, then it stops?

Sorry for the newbie questions,

Thanks,
Graeme



.

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
simple vb script to open, refina Excel Discussion (Misc queries) 0 June 14th 08 07:37 PM
Simple If, If part 2 (clarification) Steve Excel Worksheet Functions 3 July 20th 07 09:28 PM
Why won't this simple VBA script work in excel 2002? Calle Excel Discussion (Misc queries) 1 May 29th 06 12:21 PM
Simple VB Script needed Graeme[_3_] Excel Programming 1 February 2nd 04 04:40 PM
Need help with simple VBA Script Donald Parker Excel Programming 7 January 25th 04 10:19 PM


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