Recording a Macro

S

Sharon

How can I get a macro to run when it involves two lines, one under the other?
Only the top line shows.
 
S

Sharon

I recorded my Macro - It read " NOTE: We are not registered to collect tax in
your state. Please pay tax, if applicable, direct to taxing agency." I want
the first sentence on ione row and the second sentence on the next row
directly underneath it. When I play the Macro - the first sentence is the
only one to show up.
 
G

Gord Dibben

Sharon

Without seeing your code I can only give an example.

Sub two_lines()
msg = "NOTE: we are not registered to collect tax in your state." & vbLf & _
"Please pay tax, if applicable, direct to taxing agency"
MsgBox msg
End Sub


Gord Dibben MS Excel MVP
 
J

JMB

When you record the macro, turn on relative referencing (s/b a button on the
macro recording toolbar).

Probably, when you recorded the macro - the recorder put the first line in
the active cell. Then, when you hit Enter, it hardcoded the cell reference
for the second line, so every time you run it the first line will go into
whatever the currently selected cell is (relative reference) and the second
line will go into the exact same cell the second line went into when the
macro was first recorded (absolute reference).
 
S

Sharon

JMB:

Thanks. I will try this.
--
SHARON


JMB said:
When you record the macro, turn on relative referencing (s/b a button on the
macro recording toolbar).

Probably, when you recorded the macro - the recorder put the first line in
the active cell. Then, when you hit Enter, it hardcoded the cell reference
for the second line, so every time you run it the first line will go into
whatever the currently selected cell is (relative reference) and the second
line will go into the exact same cell the second line went into when the
macro was first recorded (absolute reference).
 
Top