Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Viewing Multi dimensional array
Hi
This is my first post in here and I have just recently started learnin programming Excel macros. I've been trying to do a tool that sends emai to the person that is selected from the worksheet with the information which is located on the selected row. This I can done but when I a trying to send email that contains information from more than one row have to raise my hands up. I can use arrays to set the selected range etc. (A1:A3) to the arra and even in to a multidimensional array but how can I insert thi variable into a email message body? If I break down th multidimensional array (3x3) to three one dimensionals and then joi them the formatting goes wrong. Example: Invoice Date GrossAmount 111 01.01. 100 222 02.02. 200 I create arrays Invoice(2), date(2), grossamount(2). If I know set them to my emailbody with join the view will change t this: 111 222 01.01. 02.02. 100 200 which is not what I wanted. If I use multi dimensional arrays I have no idea how to print all th "cells" in to the screen or message. Etc. Msgbox (multiArray) won' work. I could set up certain limits, how many cells user can choose, bu that's not reasonable since user have to be able select as many a she/he want's to. The number of columns is however always three. Any ideas how can I do this? This is my code so far (the email part is not included): Sub Mailia() Calculate Dim laskut() As String Dim summat() As String Dim paivat() As String Dim i As Integer Dim rivit As Integer Dim laskulista As Variant r = Chr(13) rivit = Selection.Rows.Count ReDim laskut(rivit) ReDim paivat(rivit) ReDim summat(rivit) If ActiveCell = "" Then MsgBox ("Valitse laskut, joita karhutaan") Exit Sub End If Set Laskualue = Selection Laskualue.Cells(1).Select For i = 1 To rivit laskut(i) = ActiveCell summat(i) = ActiveCell(, 2) paivat(i) = ActiveCell(, 3) ActiveCell.Offset(1, 0).Select Next i laskulista = laskut a = Join(laskut, r) b = Join(summat, r) c = Join(paivat, r) ... Best Regards Tim -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Viewing Multi dimensional array
Take a look at
http://www.rondebruin.nl/mail/folder1/mail4.htm -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "Codea " wrote in message ... Hi This is my first post in here and I have just recently started learning programming Excel macros. I've been trying to do a tool that sends email to the person that is selected from the worksheet with the information, which is located on the selected row. This I can done but when I am trying to send email that contains information from more than one row I have to raise my hands up. I can use arrays to set the selected range etc. (A1:A3) to the array and even in to a multidimensional array but how can I insert this variable into a email message body? If I break down the multidimensional array (3x3) to three one dimensionals and then join them the formatting goes wrong. Example: Invoice Date GrossAmount 111 01.01. 100 222 02.02. 200 I create arrays Invoice(2), date(2), grossamount(2). If I know set them to my emailbody with join the view will change to this: 111 222 01.01. 02.02. 100 200 which is not what I wanted. If I use multi dimensional arrays I have no idea how to print all the "cells" in to the screen or message. Etc. Msgbox (multiArray) won't work. I could set up certain limits, how many cells user can choose, but that's not reasonable since user have to be able select as many as she/he want's to. The number of columns is however always three. Any ideas how can I do this? This is my code so far (the email part is not included): Sub Mailia() Calculate Dim laskut() As String Dim summat() As String Dim paivat() As String Dim i As Integer Dim rivit As Integer Dim laskulista As Variant r = Chr(13) rivit = Selection.Rows.Count ReDim laskut(rivit) ReDim paivat(rivit) ReDim summat(rivit) If ActiveCell = "" Then MsgBox ("Valitse laskut, joita karhutaan") Exit Sub End If Set Laskualue = Selection Laskualue.Cells(1).Select For i = 1 To rivit laskut(i) = ActiveCell summat(i) = ActiveCell(, 2) paivat(i) = ActiveCell(, 3) ActiveCell.Offset(1, 0).Select Next i laskulista = laskut a = Join(laskut, r) b = Join(summat, r) c = Join(paivat, r) .. Best Regards Timo --- Message posted from http://www.ExcelForum.com/ |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
newbie question on multi-dimensional array | New Users to Excel | |||
Enumerating a multi-dimensional array | Excel Programming | |||
Problem with Multi-Dimensional Array | Excel Programming | |||
How to declare Multi-dimensional dynamic array? | Excel Programming | |||
Declaring Dynamic Multi-dimensional Array | Excel Programming |