PDA

View Full Version : typed and moving



asdzxc
09-12-2013, 10:23 PM
abcd .com (before moving) and after applying macro : abcd.com
plse write such macro

SamT
09-13-2013, 07:42 AM
Need more information

salmogomes
09-13-2013, 08:35 AM
Well, based on the information, see if you want this:

Go to VBE (Alt+F11) and put this in Object Sheet1 (or any sheet you want to modify):


Private Sub Worksheet_SelectionChange(ByVal Target As Range)

On Error GoTo a

Target = Replace(Target, " ", "")

a:

End Sub


Then write something in a cell and select it.

asdzxc
09-13-2013, 07:59 PM
Well, based on the information, see if you want this:

Go to VBE (Alt+F11) and put this in Object Sheet1 (or any sheet you want to modify):


Private Sub Worksheet_SelectionChange(ByVal Target As Range)

On Error GoTo a

Target = Replace(Target, " ", "")

a:

End Sub


Then write something in a cell and select it.

asdzxc
09-13-2013, 08:01 PM
In cell A1, I typed abcd .com and applied your macro but not working

salmogomes
09-16-2013, 05:27 AM
You have to select cell again after the typing. Ex: write something in cell A1, then select cell A2 and select A1 again.

Ringhal
09-16-2013, 07:09 AM
Or:

Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
Target = Replace(Target, " ", "")
End Sub

asdzxc
09-16-2013, 11:22 PM
Or:

Private Sub Worksheet_Change(ByVal Target As Range)
On Error Resume Next
Target = Replace(Target, " ", "")
End Sub
Book1.xlsm attached. Run macro but not working.

snb
09-17-2013, 02:32 AM
The best advice I can give you:

http://www.dummies.com/how-to/computers-software/programming/visual-basic.html

Ringhal
09-17-2013, 05:05 AM
Read the link snb posted then view the attached file.