PDA

View Full Version : Kindly help me write these excel macros



dexter23
12-14-2010, 10:26 AM
Write a macro that prints the row and column index of all the cells in the range A1:H8. (ex: prints “1,1” in cell A1, “1,2” in cell B1, etc…).

Transform the previous macro so that it can be called for any range (not only A1:H8)? Use InputBoxes to ask the desired range. For simplification purpose, assume that the range always start from cell A1.

Bob Phillips
12-14-2010, 10:45 AM
Sub OddRequest()
Dim rng As Range
Dim cell As Range

Set rng = Application.InputBox("Select a range of cells with the mouse", Type:=8)
For Each cell In rng

cell.Value = cell.Row & ", " & cell.Column
Next cell
End Sub

dexter23
12-14-2010, 11:53 AM
Thanks a lot. It worked.

dexter23
12-14-2010, 11:55 AM
please can you PM me with your e-mail address, I really need help on vba.

Bob Phillips
12-14-2010, 11:57 AM
Then ask it here, that is what the forum is for.

dexter23
12-14-2010, 12:27 PM
Thank you.I have attached a file.Kindly help me with them.Kindly use comments in the code to explain steps so I will understand.

Bob Phillips
12-14-2010, 02:23 PM
I am sorry, that reeks of homework/coursework, which is not what we are about.