• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

How do i read this for statement with... (With)

For row = reason_count + 24 To 2 * reason_count + 23

Cells(row, 1) = row - (reason_count + 22)

With Cells(row, 5)
-------------------------------------------------------------------------------------------------------
Cells(row, 5).Borders(xlEdgeTop).LineStyle = xlContinuous
-------------------------------------------------------------------------------------------------------
Cells(row, 3).Interior.Color = 12632256
-------------------------------------------------------------------------------------------------------
With Cells(row, 7) - What is the meaning of this statement?
-------------------------------------------------------------------------------------------------------
With Cells(2 * reason_count + 25, 2)
.Value = "Total Append Assets"
.Font.Bold = True
End With
 
Let's assume that the variable "row" has a value of 5. That statement then says that all of the following statements can trace back to the cell at row 5, column 7 (aka G5). Syntax is usually
Code:
With Cells(1,1)
   .Value = "Hello"
   .Font.Bold = True
End With
 
Hi Luke, Thanks for your reply..however, please help me understand remaining questions as well
-------------------------------------------------------------------------------------------------------
For row = reason_count + 24 To 2 * reason_count + 23

Cells(row, 1) = row - (reason_count + 22)

With Cells(row, 5)
-------------------------------------------------------------------------------------------------------
Cells(row, 5).Borders(xlEdgeTop).LineStyle = xlContinuous
-------------------------------------------------------------------------------------------------------
Cells(row, 3).Interior.Color = 12632256
-------------------------------------------------------------------------------------------------------
With Cells(row, 7) - What is the meaning of this statement?
---------------------------------------------------------------------

Thanks & Regards,
 
Again, I'll assume that reason_count = 5 in order to explain easier
-------------------------------------------------------------------------------------------------------
For row = reason_count + 24 To 2 * reason_count + 23 'Setup a loop along a counter. Will run from 29 to 33, with the variable "row"

Cells(row, 1) = row - (reason_count + 22) 'On the first loop, this will make cell A29 equal to (29-(5+22)), aka, equal to 2

With Cells(row, 5) 'With cell E29....
-------------------------------------------------------------------------------------------------------
Cells(row, 5).Borders(xlEdgeTop).LineStyle = xlContinuous 'Make the top border of cell E29 a solid line
-------------------------------------------------------------------------------------------------------
Cells(row, 3).Interior.Color = 12632256 'Make the fill color of cell C29 something
-------------------------------------------------------------------------------------------------------
With Cells(row, 7) - What is the meaning of this statement?
---------------------------------------------------------------------

Thanks & Regards,
 
The word "row" here is a variable, probably holding a number such as 2. The statement says that the following statements will refer to the cell at row 5, column 7 (aka G5)
 
@Luke M
Hi, buddy!
I have a lot more Q's than A's, in fact I have almost all Q's, the few A's are just like Martin Gardner Inspiration Aha...
Regards!
 
Back
Top