help on combine program

  • Thread starter Darrell_Sarrasin via OfficeKB.com
  • Start date
D

Darrell_Sarrasin via OfficeKB.com

Can I please get help with the following code.

Private Sub CommandButton1_Click()

Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
lastrow = Cells(Rows.Count, "a").End(xlUp).Row
For Each c In Range("a2:a" & lastrow)
c.Offset(, 5) = c & ", " & c.Offset(, 1) & ", " & c.Offset(, 2) & ", " & c.
Offset(, 3)
Next c
Application.ScreenUpdating = False
Application.Calculation = xlCalculationAutomatic

End Sub


this basically will read entire document and combine the cells I want. but I
want to use the sme type of program to combine just one line not read the
entire document as I want to embed it in the same sheet as another chart.

thanks.
 
P

Patrick Molloy

i don't get the question. Do you want this for a single cell?

this would work for a selected cell or range

with selection
.Offset(, 5) = c & ", " & .Offset(, 1) & ", " & .Offset(, 2) & ", " &
..Offset(, 3)
End With

or for a specific cell it would be

with Range("A1")
.Offset(, 5) = c & ", " & .Offset(, 1) & ", " & .Offset(, 2) & ", " &
..Offset(, 3)
End With
 
D

Darrell_Sarrasin via OfficeKB.com

currently I have it so that it reads the entire document in columns A-D and E
combines the lines in one cell so I can copy and paste it.

I want to be able to take it and instead of doing the entire document just
run it on one line only.

Patrick said:
i don't get the question. Do you want this for a single cell?

this would work for a selected cell or range

with selection
.Offset(, 5) = c & ", " & .Offset(, 1) & ", " & .Offset(, 2) & ", " &
.Offset(, 3)
End With

or for a specific cell it would be

with Range("A1")
.Offset(, 5) = c & ", " & .Offset(, 1) & ", " & .Offset(, 2) & ", " &
.Offset(, 3)
End With
Can I please get help with the following code.
[quoted text clipped - 19 lines]
 
D

Darrell_Sarrasin via OfficeKB.com

sorry too early in the morning.

Right now I have it so that someone can put their address in cell A-D. We
need to have it this way as we are are bringing the addresses in from a
database.

So Address is A2, city is B2, State is B3, Zip Code is B4. In b5 we
combine the addresses as we need to put that in another chart.

right now its programmed to read the entire worksheet and combine all the
lines till the last line. I just need it to run the one line not do the
entire document. so I just need it to run row 2 not all.
 
P

Patrick Molloy

you mean one row? that was covered in my code earlier

why not just have a formula
=A1 & B1 & C1 & D1 & E1



Darrell_Sarrasin via OfficeKB.com said:
currently I have it so that it reads the entire document in columns A-D
and E
combines the lines in one cell so I can copy and paste it.

I want to be able to take it and instead of doing the entire document just
run it on one line only.

Patrick said:
i don't get the question. Do you want this for a single cell?

this would work for a selected cell or range

with selection
.Offset(, 5) = c & ", " & .Offset(, 1) & ", " & .Offset(, 2) & ", " &
.Offset(, 3)
End With

or for a specific cell it would be

with Range("A1")
.Offset(, 5) = c & ", " & .Offset(, 1) & ", " & .Offset(, 2) & ", " &
.Offset(, 3)
End With
Can I please get help with the following code.
[quoted text clipped - 19 lines]
 
D

Darrell_Sarrasin via OfficeKB.com

will that not leave it as a fomula. I need to be able to copy and paste it
as we will be running about 25 instances the same day all with differnt info

Patrick said:
you mean one row? that was covered in my code earlier

why not just have a formula
=A1 & B1 & C1 & D1 & E1
currently I have it so that it reads the entire document in columns A-D
and E
[quoted text clipped - 24 lines]
 
P

Patrick Molloy

just copy/pastespecial Values

Darrell_Sarrasin via OfficeKB.com said:
will that not leave it as a fomula. I need to be able to copy and paste
it
as we will be running about 25 instances the same day all with differnt
info

Patrick said:
you mean one row? that was covered in my code earlier

why not just have a formula
=A1 & B1 & C1 & D1 & E1
currently I have it so that it reads the entire document in columns A-D
and E
[quoted text clipped - 24 lines]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top