Typed text changes cell

XDamian

New Member
Joined
Apr 19, 2010
Messages
9
I created simple macros that do the same thing. A text is typed when clicking on a button that runs my macro.
I created then a macro to delete the texts that I typed.
The texts generated by my macros appear in cells different to those I originally chose when creating my macro.
My Excel version is very old (2003).
Why does my text jump?
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
I wouldn't imagine that anyone would be able to give a good response until you post your macros ;)
 
Upvote 0
Sub Clean()
'
' Clean Macro
' Macro grabada el 26/09/2019 por Damian
'
'
Range("G2:G100").Select
Selection.ClearContents
End Sub
Sub A_149_1()
'
' A_149_1 Macro
' Macro grabada el 26/09/2019 por Damian
'
'
ActiveCell.FormulaR1C1 = "Doing a test on macros"
Range("G4").Select
End Sub
Sub A_149_2()
'
' A_149_2 Macro
' Macro grabada el 26/09/2019 por Damian
'
'
ActiveCell.FormulaR1C1 = _
"This text typed in G5 appears in G2 when I activate the macro"
Range("G5").Select
End Sub

Texts are typed in G4 and G5.
Macro is activated with a button that has been created.
Texts appear in some line in the G column.
 
Upvote 0
Your ActiveCell when the text is placed in the cell is G2 because of the first line in your sub where you select the range to be cleared. You don't need to use select.
 
Upvote 0
...
Code:
Range("G2:G100").ClearContents
Also
Code:
Range("G4").Value = "Doing a test on macros"

And the same syntax for G5 if you don't actually need the ActiveCell to change.
 
Last edited:
Upvote 0
...
Code:
Range("G2:G100").ClearContents
Also
Code:
Range("G4").Value = "Doing a test on macros"

And the same syntax for G5 if you don't actually need the ActiveCell to change.

Thanks, but that does not work.
Syntaxis error.
Thanks for the suggestion.
 
Upvote 0
So much better for you ( no syntax error).
Now the text appears wherever it wants.
Thanks for your effort.
 
Upvote 0

Forum statistics

Threads
1,214,430
Messages
6,119,443
Members
448,898
Latest member
drewmorgan128

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top