Cells range into an array, then into msgbox
Hi Tony
Are the values numerics or text
Sub collate()
'If numerics and you are trying to sum then the below will do
MsgBox Application.Sum(Range("F2:H50"))
'incase these are text
Dim cell As Range,impe As String
For Each cell In Range("F2:H50")
If cell.Text < "" Then impe = impe & cell.Text
Next
MsgBox impe
End Sub
--
Jacob (MVP - Excel)
"Tony Zappal" wrote:
Hi all,
I have a range of cells which are either blank or contain data.
I'd like to create a dynamic(?) array and enter the values of those cells.
Then, after that, i'd like to output the array into a msgbox.
I've started with the below code, but am struggling to get it to work and to
do what i'm required. Can anyone help?
Cheers,
Tony Z.
Sub collate()
Dim N As Long
Arr = Range("F2:H50").Value
For N = LBound(Arr) To UBound(Arr)
impe = impe + Arr(N)
Next N
MsgBox impe
End Sub
|