Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Your description of what you are trying to do is not entirely clear and,
unfortunately, your non-working example code doesn't really clarify it for us. Can you give us an actual example so we can see what you are hoping to do? For example, let's say your range is F2:H3... show us some sample values that you might have in that range and then show us what you want to display from them in the MessageBox. -- Rick (MVP - Excel) "Tony Zappal" wrote in message ... 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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
Apologies for the vagueness. Essentially what i am trying to do, is put the cell values in a range into an array. The cell values will consist of numbers, 8 characters long. I then want to build a string from the values in the array, seperated by a comma. That string i then want to enter into a msgbox amongst other things. (Included the code example of what i have done so far to show i'm trying :) ) Cheers, Tony Z. "Rick Rothstein" wrote: Your description of what you are trying to do is not entirely clear and, unfortunately, your non-working example code doesn't really clarify it for us. Can you give us an actual example so we can see what you are hoping to do? For example, let's say your range is F2:H3... show us some sample values that you might have in that range and then show us what you want to display from them in the MessageBox. -- Rick (MVP - Excel) "Tony Zappal" wrote in message ... 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 . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Display an array in a MsgBox | Excel Programming | |||
How to copy VBA array into range of cells? | Excel Programming | |||
Sum Array Range & Individual Cells | Excel Discussion (Misc queries) | |||
Setting an array range of cells??? | Excel Programming | |||
Problem with array and msgbox | Excel Worksheet Functions |