Okay first of all if a column contains a 0 is that considered to be blank as well or just the Null instance (I'll right with a zero being considered nothing)? Also by saying do not concantenate do you mean skip that col and concantenate the next or skip the col altogether (I'm assuming the latter) -- either/or here is the code you need. Granted you might have to tailor the syntax a bit since I know numerous languages and sometimes do not recall the exact syntax for VBA in conjunction with Excel.
...I assume you have done what you need to connect to the source worksheet and the destination worksheet you are using.
** There is a way to get the Row Count so you make this dynamic if need be
max_num_rows = 2137
max_num_cols = 100
dest_row = 0
For row_idx = 0 to max_num_rows
itration_cnt = 0
col_cnt = 0
dest_col = 0
For col_idx = 0 to max_num_cols
itration_cnt = itration_cnt + 1
** Cannot recall if this the following is a function or not
If wrksheet(row_idx, col_idx) Is Not Null Then
If wrksheet(row_idx, col_idx) <> 0 Then ** remove this IF - if this is not the case
If itration_cnt = 1 Then
NumStr = NumToString(wrksheet(row_idx, col_idx))
col_cnt = 1
Else
itration_cnt = 0
If col_cnt = 1 Then
NumStr = NumStr & "_"
End If
NumStr = NumStr & NumToString(wrksheet(row_idx, col_idx))
DestWrkSheet(dest_row, dest_col) = NumStr
dest_col = dest_col + 1
col_cnt = 0
End If
End If
End If
Next col_idx
dest_row = dest_row + 1
Next row_idx
Okay the NumToString function is an instrinsic function but I think it has more parameters and may be named differently. I put this one in to denote what/where you are using.
I hope that is what you were looking for.
--- On Sat, 12/11/10, jeffdeck2001 <jeffdeck2001@yahoo.com> wrote:
From: jeffdeck2001 <jeffdeck2001@yahoo.com>
Subject: [Access VBA Central] How to Concatenate multiple columns of numbers?
To: AccessVBACentral@yahoogroups.com
Date: Saturday, December 11, 2010, 6:59 AM
How to Concatenate multiple columns of numbers?
I am using Excel 2007 VBA -- and need to concatenate 100 columns
of numbers into 50, with 2137 rows. If a cell is empty, then do
not concatenate. End script when first empty row is reached.
Two columns of numbers will be concatenated and separated by
an underscore.
Numbers in each cell come from database, and will appear
to be random to the casual observer, though each number has
significant meaning.
Example:
Columns
A1----B1----C1----D1----E1----F1
12----2----13----1----256----3
After VBA script is run:
Columns
A1------B1------C1
12_2----13_1----256_3
[Non-text portions of this message have been removed]
Tecnologia, programação e muito Visual FoxPro.
domingo, 12 de dezembro de 2010
Re: [Access VBA Central] How to Concatenate multiple columns of numbers?
__._,_.___
MARKETPLACE
.
__,_._,___
Assinar:
Postar comentários (Atom)
Arquivo do blog
-
▼
2010
(3087)
-
▼
dezembro
(325)
- Bls: ]] XL-mania [[ menghitung persentase bonus de...
- [Access VBA Central] AUTO: David Deroian is out of...
- Re: ]] XL-mania [[ menghitung persentase bonus den...
- Re: ]] XL-mania [[ Pengurangan dan penjumlahan dal...
- Re: ]] XL-mania [[ menghitung persentase bonus den...
- Re: ]] XL-mania [[ menghitung persentase bonus den...
- Re: ]] XL-mania [[ menghitung persentase bonus den...
- Re: ]] XL-mania [[ Pengurangan dan penjumlahan dal...
- Bls: ]] XL-mania [[ Pengurangan dan penjumlahan da...
- ]] XL-mania [[ menghitung persentase bonus dengan ...
- Re: ]] XL-mania [[ Merubah tabel ke format berbeda
- ]] XL-mania [[ Pengurangan dan penjumlahan dalam i...
- RE: [usuarios_fox] pdf
- Re: ]] XL-mania [[ Menjumlahkan tanggal dikurangi ...
- Bls: ]] XL-mania [[ Lot Awal dan Akhir
- Re: ]] XL-mania [[ pika pika
- RE: [usuarios_fox] pdf
- RE: {Disarmed} Re: [usuarios_fox] pdf
- RE: [usuarios_fox] pdf
- [Access VBA Central] Help with Query by Form
- Re: ]] XL-mania [[ Lot Awal dan Akhir
- Re: ]] XL-mania [[ Menjumlahkan tanggal dikurangi ...
- ]] XL-mania [[ Merubah tabel ke format berbeda
- Bls: ]] XL-mania [[ Penggunaan Tombol CTRL {
- RE: ]] XL-mania [[ pika pika
- ]] XL-mania [[ need vba converter?
- ]] XL-mania [[ Lot Awal dan Akhir
- Re: ]] XL-mania [[ Change Tabel
- Re: ]] XL-mania [[ pika pika
- Re: ]] XL-mania [[ Menjumlahkan tanggal dikurangi ...
- RE: ]] XL-mania [[ Change Tabel
- Re: ]] XL-mania [[ Change Tabel
- Re: ]] XL-mania [[ Penggunaan Tombol CTRL {
- Re: ]] XL-mania [[ Change Tabel
- ]] XL-mania [[ membikin userform full screen
- Bls: ]] XL-mania [[ Change Tabel
- ]] XL-mania [[ Penggunaan Tombol CTRL {
- Re: ]] XL-mania [[ pika pika
- Bls: ]] XL-mania [[ Change Tabel
- ]] XL-mania [[ Change Tabel
- Re: ]] XL-mania [[ Menggabung Frame menjadi Tabel
- Bls: ]] XL-mania [[ Cara menentukan data terkecil ...
- ]] XL-mania [[ Shared File Excel Berbeda Hasil ...
- Re: ]] XL-mania [[ save as dgn nama worksheet sesu...
- Re: ]] XL-mania [[ Membuat Beberapa pilhan
- Re: ]] XL-mania [[ Macro dipayslip error --help--
- ]] XL-mania [[ PO_automatic
- Bls: ]] XL-mania [[ Menentukan Kelompok Atas dan B...
- Re: ]] XL-mania [[ Cara menentukan data terkecil d...
- Re: ]] XL-mania [[ Cara menentukan data terkecil d...
- ]] XL-mania [[ Formula utk mencari perkalian P dan...
- Re: ]] XL-mania [[ Menentukan Kelompok Atas dan Ba...
- Re: ]] XL-mania [[ Menjumlahkan tanggal dikurangi ...
- ]] XL-mania [[ Cara menentukan data terkecil dan t...
- Re: ]] XL-mania [[ Daftar "LiburNasional" & "Cut b...
- Re: ]] XL-mania [[ Daftar "LiburNasional" & "Cut b...
- Re: ]] XL-mania [[ Pindah sel otomatis
- ]] XL-mania [[ Macro dipayslip error --help--
- ]] XL-mania [[ Template Aging Report AP + AR
- ]] XL-mania [[ File - rules_and_tips
- Re: ]] XL-mania [[ Formula kombinasi Text, Bulan d...
- RE: ]] XL-mania [[ Daftar "LiburNasional" & "Cut b...
- Re: ]] XL-mania [[ Formula kombinasi Text, Bulan d...
- Bls: ]] XL-mania [[ Formula kombinasi Text, Bulan ...
- Re: ]] XL-mania [[ Menampilan data berdasarkan ran...
- ]] XL-mania [[ Menggabung Frame menjadi Tabel
- Re: ]] XL-mania [[ Menampilan data berdasarkan ran...
- Bls: ]] XL-mania [[ Menampilan data berdasarkan ra...
- ]] XL-mania [[ Formula kombinasi Text, Bulan dan u...
- ]] XL-mania [[ Pindah sel otomatis
- Re: ]] XL-mania [[ Luas Real dari tanggal rencana
- Bls: ]] XL-mania [[ mohon bantuan untuk makro fun...
- ]] XL-mania [[ Status Bar
- Re: calculated field di pivot table was >>>RE: ]] ...
- Re: ]] XL-mania [[ Menentukan cell dengan format r...
- RE: ]] XL-mania [[ Luas Real dari tanggal rencana
- ]] XL-mania [[ pika pika
- Re: ]] XL-mania [[ autoformating
- Re: ]] XL-mania [[ mohon bantuan untuk makro fungs...
- Re: ]] XL-mania [[ Menjumlahkan tanggal dikurangi ...
- ]] XL-mania [[ Menentukan cell dengan format round
- Re: ]] XL-mania [[ Nilai max dari 2 kolom dari 2 s...
- ]] XL-mania [[ Menampilan data berdasarkan range t...
- Re: ]] XL-mania [[ cara melakukan copy-paste selan...
- Bls: ]] XL-mania [[ autoformating
- ]] XL-mania [[ Daftar "LiburNasional" & "Cut bersa...
- Re: ]] XL-mania [[ autoformating
- Re: ]] XL-mania [[ Kombinasi fungsi If dengan vlookup
- ]] XL-mania [[ Form Denda "BELI KUE"
- ]] XL-mania [[ Luas Real dari tanggal rencana
- calculated field di pivot table was >>>RE: ]] XL-m...
- Re: ]] XL-mania [[ Error Macro Sumproduct
- Re: ]] XL-mania [[ mencetak/print "insert comment"...
- RE: ]] XL-mania [[ mencetak/print "insert comment"...
- Re: ]] XL-mania [[ Menjumlahkan tanggal dikurangi ...
- ]] XL-mania [[ mencetak/print "insert comment" di ...
- ]] XL-mania [[ autoformating
- Re: ]] XL-mania [[ Nilai max dari 2 kolom dari 2 s...
- Re: ]] XL-mania [[ Sorting Problem
- Re: ]] XL-mania [[ Menambah Data Access dengan Excell
-
▼
dezembro
(325)
Nenhum comentário:
Postar um comentário