Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Advice about loop and cell action

Hi, I am a new learner. I created the loop below with the
help of macro. Now I am wondering is there anyway to
shorten this block of code - (also any statements that i
can safely leave out?)

Thank you. My question may sound foolish..I am grateful
for your understanding and assistance.
Tetsu Hara

Dim row As Integer
row = 11
Do While row < 157
row = row + 2
For col = 1 To 3
Range(Cells(row, col), Cells(row + 1, col)).Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Next col
Loop
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Advice about loop and cell action

Dim row As Integer
For row = 11 To 156
For col = 1 To 3
With Range(Cells(row+2, col), Cells(row + 3, col))
.MergeCells = True
End With
Next col
Next row

--

HTH

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

"Tetsuhara" wrote in message
...
Hi, I am a new learner. I created the loop below with the
help of macro. Now I am wondering is there anyway to
shorten this block of code - (also any statements that i
can safely leave out?)

Thank you. My question may sound foolish..I am grateful
for your understanding and assistance.
Tetsu Hara

Dim row As Integer
row = 11
Do While row < 157
row = row + 2
For col = 1 To 3
Range(Cells(row, col), Cells(row + 1, col)).Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = True
End With
Next col
Loop



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
Excell copy action pauses for 15 second for the smallest action Meekal Excel Discussion (Misc queries) 1 January 28th 10 04:30 PM
Perform action if value in cell - conditional VB stmt Studebaker Excel Discussion (Misc queries) 2 February 29th 08 06:34 PM
Cell Formatting Advice:- Text displayed as .........####### Dermot Excel Discussion (Misc queries) 1 May 23rd 06 12:14 AM
Excel VBA - Action if a cell holds a certain value? hibatt Excel Programming 2 June 19th 04 08:24 PM
Perform action when cell is clicked Jason[_26_] Excel Programming 3 October 4th 03 06:08 PM


All times are GMT +1. The time now is 02:56 AM.

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"