ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   combine information in two cells into the third column (https://www.excelbanter.com/excel-discussion-misc-queries/129346-combine-information-two-cells-into-third-column.html)

May

combine information in two cells into the third column
 
I've been trying to write a macro as below to commit above task, but errors
like "variable not defined" and "sub or function not defined" keep poping up.

Sub Macro1()
x = 3
Do While ActiveCell(x, 11).Value < ""
Cells(x, 10).Value = "PO#" + Cell(x, 1).Value + " " + Cell(x, 3).Value
x = x + 1
Loop

End Sub

Could you please help? I'm a beginner at the stage and so happy to find out
this wonderful community.

Sean Timmons

combine information in two cells into the third column
 
after Sub Macro1()
Type:

Dim x as Integer

That will define your variable for the system.

"May" wrote:

I've been trying to write a macro as below to commit above task, but errors
like "variable not defined" and "sub or function not defined" keep poping up.

Sub Macro1()
x = 3
Do While ActiveCell(x, 11).Value < ""
Cells(x, 10).Value = "PO#" + Cell(x, 1).Value + " " + Cell(x, 3).Value
x = x + 1
Loop

End Sub

Could you please help? I'm a beginner at the stage and so happy to find out
this wonderful community.


Gord Dibben

combine information in two cells into the third column
 
May

Couple of things to change....................note the "&" which is the
concatenation operator. "+" is for arithmetic.

Also "Cells" instead of "Cell"

Sub Macro1()
Dim x As Integer
x = 3
Do While Cells(x, 11).Value < ""
Cells(x, 10).Value = "PO#" & Cells(x, 1).Value & " " & Cells(x, 3).Value
x = x + 1
Loop

End Sub


Gord Dibben MS Excel MVP

On Mon, 5 Feb 2007 15:10:00 -0800, May wrote:

I've been trying to write a macro as below to commit above task, but errors
like "variable not defined" and "sub or function not defined" keep poping up.

Sub Macro1()
x = 3
Do While ActiveCell(x, 11).Value < ""
Cells(x, 10).Value = "PO#" + Cell(x, 1).Value + " " + Cell(x, 3).Value
x = x + 1
Loop

End Sub

Could you please help? I'm a beginner at the stage and so happy to find out
this wonderful community.




All times are GMT +1. The time now is 08:29 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com