Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 85
Default How do you cut a paste a macro or VB language in Excel and make it

I have some code that soemone sent me to cut and paste as a macro to performa
function. I do not know how to do that. I can get to the VB window, but I
don't knwo what do do from there.

Help!
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 97
Default How do you cut a paste a macro or VB language in Excel and make it


Sub Macro1()

'recorded with Macro recorder
Range("A1:A2").Select
Selection.Cut
Range("B1").Select
ActiveSheet.Paste
End Sub

Sub CutMethod()

' looking up 'Cut Method' in help and modifying Example
Worksheets("Sheet1").Range("A1:A2").Cut Range("B1:B2")

End Sub

"Angela" wrote in message
...
I have some code that soemone sent me to cut and paste as a macro to
performa
function. I do not know how to do that. I can get to the VB window, but
I
don't knwo what do do from there.

Help!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 85
Default How do you cut a paste a macro or VB language in Excel and mak

Thanks - but actually, the code was to remove hard returns in cells. I do
not know how to run the code in VB.

"Steve" wrote:


Sub Macro1()

'recorded with Macro recorder
Range("A1:A2").Select
Selection.Cut
Range("B1").Select
ActiveSheet.Paste
End Sub

Sub CutMethod()

' looking up 'Cut Method' in help and modifying Example
Worksheets("Sheet1").Range("A1:A2").Cut Range("B1:B2")

End Sub

"Angela" wrote in message
...
I have some code that soemone sent me to cut and paste as a macro to
performa
function. I do not know how to do that. I can get to the VB window, but
I
don't knwo what do do from there.

Help!




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default How do you cut a paste a macro or VB language in Excel and mak

Angela

In Excel hit Alt+F11. That will open the Visual Basic Editor (VBE). In
the VBE from the menus select InsertModule. That will create a new
module and your cursor will be near the top of the module. Paste you VBA
code right there. Then hit Alt+Q to return to Excel. In Excel from the
Menus select ToolsMacroMacros (or Alt+F8) to open a list of macros -
I'm guessing there will be just the one. Click on the macro and select Run.

Hope this helps
Rowan

Angela wrote:
Thanks - but actually, the code was to remove hard returns in cells. I do
not know how to run the code in VB.

"Steve" wrote:


Sub Macro1()

'recorded with Macro recorder
Range("A1:A2").Select
Selection.Cut
Range("B1").Select
ActiveSheet.Paste
End Sub

Sub CutMethod()

' looking up 'Cut Method' in help and modifying Example
Worksheets("Sheet1").Range("A1:A2").Cut Range("B1:B2")

End Sub

"Angela" wrote in message
...

I have some code that soemone sent me to cut and paste as a macro to
performa
function. I do not know how to do that. I can get to the VB window, but
I
don't knwo what do do from there.

Help!




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 85
Default How do you cut a paste a macro or VB language in Excel and mak

Well - maybe I should start over. that does answer my question. Thank you,
however, my problem is not solved. Here's the situation. I imported all of
my contacts from Outlook. In the address section, there are hard returns. I
need to eliminate the hard returns and move the data beyond the HRT in to the
cell to the right. For example: "123||Anywhere Street||Suite 400||City
State". I would like to eliminate the HRT and move suite 400 in to the cell
to the right.

Thanks so much for your help and patience.

"Rowan Drummond" wrote:

Angela

In Excel hit Alt+F11. That will open the Visual Basic Editor (VBE). In
the VBE from the menus select InsertModule. That will create a new
module and your cursor will be near the top of the module. Paste you VBA
code right there. Then hit Alt+Q to return to Excel. In Excel from the
Menus select ToolsMacroMacros (or Alt+F8) to open a list of macros -
I'm guessing there will be just the one. Click on the macro and select Run.

Hope this helps
Rowan

Angela wrote:
Thanks - but actually, the code was to remove hard returns in cells. I do
not know how to run the code in VB.

"Steve" wrote:


Sub Macro1()

'recorded with Macro recorder
Range("A1:A2").Select
Selection.Cut
Range("B1").Select
ActiveSheet.Paste
End Sub

Sub CutMethod()

' looking up 'Cut Method' in help and modifying Example
Worksheets("Sheet1").Range("A1:A2").Cut Range("B1:B2")

End Sub

"Angela" wrote in message
...

I have some code that soemone sent me to cut and paste as a macro to
performa
function. I do not know how to do that. I can get to the VB window, but
I
don't knwo what do do from there.

Help!






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 97
Default How do you cut a paste a macro or VB language in Excel and mak

Angela

Just opened this. Looks like you have an address over a range of columns.
Why not use a formula?

= A1 & " " & B1 & ", " & C1 & ", " & D1

Steve

"Angela" wrote in message
...
Well - maybe I should start over. that does answer my question. Thank
you,
however, my problem is not solved. Here's the situation. I imported all
of
my contacts from Outlook. In the address section, there are hard returns.
I
need to eliminate the hard returns and move the data beyond the HRT in to
the
cell to the right. For example: "123||Anywhere Street||Suite 400||City
State". I would like to eliminate the HRT and move suite 400 in to the
cell
to the right.

Thanks so much for your help and patience.

"Rowan Drummond" wrote:

Angela

In Excel hit Alt+F11. That will open the Visual Basic Editor (VBE). In
the VBE from the menus select InsertModule. That will create a new
module and your cursor will be near the top of the module. Paste you VBA
code right there. Then hit Alt+Q to return to Excel. In Excel from the
Menus select ToolsMacroMacros (or Alt+F8) to open a list of macros -
I'm guessing there will be just the one. Click on the macro and select
Run.

Hope this helps
Rowan

Angela wrote:
Thanks - but actually, the code was to remove hard returns in cells. I
do
not know how to run the code in VB.

"Steve" wrote:


Sub Macro1()

'recorded with Macro recorder
Range("A1:A2").Select
Selection.Cut
Range("B1").Select
ActiveSheet.Paste
End Sub

Sub CutMethod()

' looking up 'Cut Method' in help and modifying Example
Worksheets("Sheet1").Range("A1:A2").Cut Range("B1:B2")

End Sub

"Angela" wrote in message
...

I have some code that soemone sent me to cut and paste as a macro to
performa
function. I do not know how to do that. I can get to the VB window,
but
I
don't knwo what do do from there.

Help!






  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,494
Default How do you cut a paste a macro or VB language in Excel and mak

do a find and replace
look for ||

replace with cooma

then do a text to columns with the comma delimiter

--


Gary


"Angela" wrote in message
...
Well - maybe I should start over. that does answer my question. Thank
you,
however, my problem is not solved. Here's the situation. I imported all
of
my contacts from Outlook. In the address section, there are hard returns.
I
need to eliminate the hard returns and move the data beyond the HRT in to
the
cell to the right. For example: "123||Anywhere Street||Suite 400||City
State". I would like to eliminate the HRT and move suite 400 in to the
cell
to the right.

Thanks so much for your help and patience.

"Rowan Drummond" wrote:

Angela

In Excel hit Alt+F11. That will open the Visual Basic Editor (VBE). In
the VBE from the menus select InsertModule. That will create a new
module and your cursor will be near the top of the module. Paste you VBA
code right there. Then hit Alt+Q to return to Excel. In Excel from the
Menus select ToolsMacroMacros (or Alt+F8) to open a list of macros -
I'm guessing there will be just the one. Click on the macro and select
Run.

Hope this helps
Rowan

Angela wrote:
Thanks - but actually, the code was to remove hard returns in cells. I
do
not know how to run the code in VB.

"Steve" wrote:


Sub Macro1()

'recorded with Macro recorder
Range("A1:A2").Select
Selection.Cut
Range("B1").Select
ActiveSheet.Paste
End Sub

Sub CutMethod()

' looking up 'Cut Method' in help and modifying Example
Worksheets("Sheet1").Range("A1:A2").Cut Range("B1:B2")

End Sub

"Angela" wrote in message
...

I have some code that soemone sent me to cut and paste as a macro to
performa
function. I do not know how to do that. I can get to the VB window,
but
I
don't knwo what do do from there.

Help!






  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 97
Default How do you cut a paste a macro or VB language in Excel and mak

Angela

That's a totally different problem. If you mean the returns created by
pressing [Alt]/[Enter], cut/paste won't fix it.
Presseing [Alt]/[Enter] creates a special character that causes Excel to go
to a new line. In VBA, this is character 10 (Chr(10)). This character cots
and pastes with other values.

The following will strip Chr(10) from the cells you select:.

Sub ReplaceHardRtn()
' replaces character created by Alt/Enter
' select the range with the hard returns first
' Leaves values in the same location.
For Each c In Selection
c.Replace What:=Chr(10), Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
Next c
End Sub


Use Rowan's instructions to put this into a module and run it.

Test it on a single cell first to make sure it does what you want. If happy,
select whatever range you want cleaned then run it.



Steve

"Angela" wrote in message
...
Thanks - but actually, the code was to remove hard returns in cells. I do
not know how to run the code in VB.

"Steve" wrote:


Sub Macro1()

'recorded with Macro recorder
Range("A1:A2").Select
Selection.Cut
Range("B1").Select
ActiveSheet.Paste
End Sub

Sub CutMethod()

' looking up 'Cut Method' in help and modifying Example
Worksheets("Sheet1").Range("A1:A2").Cut Range("B1:B2")

End Sub

"Angela" wrote in message
...
I have some code that soemone sent me to cut and paste as a macro to
performa
function. I do not know how to do that. I can get to the VB window,
but
I
don't knwo what do do from there.

Help!






  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 97
Default How do you cut a paste a macro or VB language in Excel and mak

Angela

You may need to modify
Replacement:="" to
Replacement:=" "

The former was a zero length character. The latter is a blank character.

Example:

abc
def

the former result in "abcdef"
the latter results in "abc def"

Happy macroing

Steve

"Steve" <No Spam wrote in message ...
Angela

That's a totally different problem. If you mean the returns created by
pressing [Alt]/[Enter], cut/paste won't fix it.
Presseing [Alt]/[Enter] creates a special character that causes Excel to
go to a new line. In VBA, this is character 10 (Chr(10)). This character
cots and pastes with other values.

The following will strip Chr(10) from the cells you select:.

Sub ReplaceHardRtn()
' replaces character created by Alt/Enter
' select the range with the hard returns first
' Leaves values in the same location.
For Each c In Selection
c.Replace What:=Chr(10), Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
Next c
End Sub


Use Rowan's instructions to put this into a module and run it.

Test it on a single cell first to make sure it does what you want. If
happy, select whatever range you want cleaned then run it.



Steve

"Angela" wrote in message
...
Thanks - but actually, the code was to remove hard returns in cells. I
do
not know how to run the code in VB.

"Steve" wrote:


Sub Macro1()

'recorded with Macro recorder
Range("A1:A2").Select
Selection.Cut
Range("B1").Select
ActiveSheet.Paste
End Sub

Sub CutMethod()

' looking up 'Cut Method' in help and modifying Example
Worksheets("Sheet1").Range("A1:A2").Cut Range("B1:B2")

End Sub

"Angela" wrote in message
...
I have some code that soemone sent me to cut and paste as a macro to
performa
function. I do not know how to do that. I can get to the VB window,
but
I
don't knwo what do do from there.

Help!







  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 85
Default How do you cut a paste a macro or VB language in Excel and mak

Thanks everyone so much!

Steve: That worked, however, it seemed to only remove one of the || from
the cells. It is as though one of the HRT still exists and the macor won't
remove it.
Any ideas?

"Steve" wrote:

Angela

You may need to modify
Replacement:="" to
Replacement:=" "

The former was a zero length character. The latter is a blank character.

Example:

abc
def

the former result in "abcdef"
the latter results in "abc def"

Happy macroing

Steve

"Steve" <No Spam wrote in message ...
Angela

That's a totally different problem. If you mean the returns created by
pressing [Alt]/[Enter], cut/paste won't fix it.
Presseing [Alt]/[Enter] creates a special character that causes Excel to
go to a new line. In VBA, this is character 10 (Chr(10)). This character
cots and pastes with other values.

The following will strip Chr(10) from the cells you select:.

Sub ReplaceHardRtn()
' replaces character created by Alt/Enter
' select the range with the hard returns first
' Leaves values in the same location.
For Each c In Selection
c.Replace What:=Chr(10), Replacement:="", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False
Next c
End Sub


Use Rowan's instructions to put this into a module and run it.

Test it on a single cell first to make sure it does what you want. If
happy, select whatever range you want cleaned then run it.



Steve

"Angela" wrote in message
...
Thanks - but actually, the code was to remove hard returns in cells. I
do
not know how to run the code in VB.

"Steve" wrote:


Sub Macro1()

'recorded with Macro recorder
Range("A1:A2").Select
Selection.Cut
Range("B1").Select
ActiveSheet.Paste
End Sub

Sub CutMethod()

' looking up 'Cut Method' in help and modifying Example
Worksheets("Sheet1").Range("A1:A2").Cut Range("B1:B2")

End Sub

"Angela" wrote in message
...
I have some code that soemone sent me to cut and paste as a macro to
performa
function. I do not know how to do that. I can get to the VB window,
but
I
don't knwo what do do from there.

Help!










Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how can i make a frame in excel, paste pictures without resizing? Ronald Excel Discussion (Misc queries) 1 November 7th 08 03:07 PM
How to change German language data into Eglish Language in a colum Execel work sheet language problems Excel Discussion (Misc queries) 1 October 29th 07 09:59 PM
language support in excel sheet using a third party language tool seema Excel Worksheet Functions 0 March 13th 06 06:06 AM
Macro Language T.A. Oliver Excel Programming 3 July 5th 05 06:28 PM
How to change the excel format from language to language? zee Excel Discussion (Misc queries) 2 January 30th 05 06:51 PM


All times are GMT +1. The time now is 03:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"