![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
New Member
Join Date: Apr 2002
Posts: 14
|
Hello All,
I am trying to create a string "RangeStr" referencing a range specified only in terms of row and column #s. ie. Given that A1 = Cells(1,1) and A10 = Cells(10,1) I want RangeStr = "A1:A10" I tried Dim RangeStr As String RangeStr = CStr(Range((Cells(1,1), Cells(10,1))) But I get a type mismatch error I eventually want to use RangeStr to write a formula into another cell Cells(rowno,1).Formula = "=sum(" & RangeStr & ")" I'd really appreciate any help on this. Thanks! Manish [ This Message was edited by: mangoel on 2002-05-21 15:37 ] |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Portland, OR USA
Posts: 1,374
|
You're almost there.
Try this: RangeStr = Range((Cells(1,1), Cells(10,1)).Address(False, False) HTH, Russell |
|
|
|
|
|
#3 |
|
New Member
Join Date: Apr 2002
Posts: 14
|
Russell,
Thank you very much! That worked perfectly. BTW what does the .Address(False,False) do? Regards, Manish |
|
|
|
|
|
#4 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: Portland, OR USA
Posts: 1,374
|
Quote:
If you left them out, you would get "$A$1:$A$10" -- which would also work in your sum formula, but would not if you wanted to drag (fill) the formula to other cells. Glad I could help, Russell |
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|