Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using Debug.Print with Range Variable with more than one cell
I have a range variable. I want to print its value to the Immediate Window
upon selection of it. Currently I use this to do so: var1 = Target Debug.Print var1 However this fails if the range is greater than one cell. How can I modify this to print all values in the selection? Thanks EM |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using Debug.Print with Range Variable with more than one cell
var1 = Range("A1:A10")
For Each strval In var1 Debug.Print strval Next -- If this post helps click Yes --------------- Jacob Skaria "ExcelMonkey" wrote: I have a range variable. I want to print its value to the Immediate Window upon selection of it. Currently I use this to do so: var1 = Target Debug.Print var1 However this fails if the range is greater than one cell. How can I modify this to print all values in the selection? Thanks EM |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using Debug.Print with Range Variable with more than one cell
This way your range can be dynamic
Sub way() Dim yourVariable As Range Dim i As Long Set yourVariable = Selection For i = 1 To Selection.Cells.Count Debug.Print yourVariable(i) Next End Sub "Jacob Skaria" wrote: var1 = Range("A1:A10") For Each strval In var1 Debug.Print strval Next -- If this post helps click Yes --------------- Jacob Skaria "ExcelMonkey" wrote: I have a range variable. I want to print its value to the Immediate Window upon selection of it. Currently I use this to do so: var1 = Target Debug.Print var1 However this fails if the range is greater than one cell. How can I modify this to print all values in the selection? Thanks EM |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Using Debug.Print with Range Variable with more than one cell
Thanks
"Jacob Skaria" wrote: var1 = Range("A1:A10") For Each strval In var1 Debug.Print strval Next -- If this post helps click Yes --------------- Jacob Skaria "ExcelMonkey" wrote: I have a range variable. I want to print its value to the Immediate Window upon selection of it. Currently I use this to do so: var1 = Target Debug.Print var1 However this fails if the range is greater than one cell. How can I modify this to print all values in the selection? Thanks EM |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Set print area on variable range | Excel Programming | |||
Variable Print Range | Excel Programming | |||
debug.print range "full" address | Excel Programming | |||
debug error: object variable not set | Excel Programming | |||
Setting up a variable print range | Excel Programming |