Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Macro Writing

I canNOT figure out Visual Basic Language. All I want my macro to do is to
go to the end of the first line, delete the second line, cut the third line,
past the third line in the cell to the right of the cell I'm editing, and
then go to the cell below the cell I was editing.

When I record this macro it only works in the EXACT cells I edited, not in
any other cells.

Oh help, please.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Macro Writing

Don, Thank you for responding!!!

No, by line I mean a line of text in a cell which has three lines of text,
separated by "Alt Enter."

I've pasted my macro below. Sorry, I should have thought of doing that from
the start. See where the selection names specific text in the cell and the
ranges are specific cells names? I'm working toward a generic cut and paste
macro that I can use down a column of roughly 120 rows.

Sub Macro5()
'
' Macro5 Macro
' Macro recorded 4/20/2005 by CC Dietrich
'
' Keyboard Shortcut: Ctrl+j
'
ActiveCell.FormulaR1C1 = _
"Danai Tsapikidou
------------------ "
With ActiveCell.Characters(Start:=1, Length:=77).Font
.Name = "Tahoma"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Range("P3").Select
ActiveSheet.Paste
Range("O4").Select
End Sub




"Don Guillett" wrote:

As always post your macro for comments. By "line", do you mean row?

--
Don Guillett
SalesAid Software

"DFIChris" wrote in message
...
I canNOT figure out Visual Basic Language. All I want my macro to do is

to
go to the end of the first line, delete the second line, cut the third

line,
past the third line in the cell to the right of the cell I'm editing, and
then go to the cell below the cell I was editing.

When I record this macro it only works in the EXACT cells I edited, not in
any other cells.

Oh help, please.




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Macro Writing

try this

Sub findandmovetext()
v1 = InStr(ActiveCell, Chr(10))
v2 = InStr(v1 + 1, ActiveCell, Chr(10))
ActiveCell.Offset(, 1) = Right(ActiveCell, Len(ActiveCell) - v2)
ActiveCell.Value = Left(ActiveCell, v1 - 1)
End Sub


--
Don Guillett
SalesAid Software

"DFIChris" wrote in message
...
Don, Thank you for responding!!!

No, by line I mean a line of text in a cell which has three lines of text,
separated by "Alt Enter."

I've pasted my macro below. Sorry, I should have thought of doing that

from
the start. See where the selection names specific text in the cell and

the
ranges are specific cells names? I'm working toward a generic cut and

paste
macro that I can use down a column of roughly 120 rows.

Sub Macro5()
'
' Macro5 Macro
' Macro recorded 4/20/2005 by CC Dietrich
'
' Keyboard Shortcut: Ctrl+j
'
ActiveCell.FormulaR1C1 = _
"Danai Tsapikidou
------------------ "
With ActiveCell.Characters(Start:=1, Length:=77).Font
.Name = "Tahoma"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Range("P3").Select
ActiveSheet.Paste
Range("O4").Select
End Sub




"Don Guillett" wrote:

As always post your macro for comments. By "line", do you mean row?

--
Don Guillett
SalesAid Software

"DFIChris" wrote in message
...
I canNOT figure out Visual Basic Language. All I want my macro to do

is
to
go to the end of the first line, delete the second line, cut the third

line,
past the third line in the cell to the right of the cell I'm editing,

and
then go to the cell below the cell I was editing.

When I record this macro it only works in the EXACT cells I edited,

not in
any other cells.

Oh help, please.






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Macro Writing

for multiple cells in a selected range

Sub findandmovetextinrange()
For Each c In Selection
v1 = InStr(c, Chr(10))
v2 = InStr(v1 + 1, c, Chr(10))
c.Offset(, 1) = Right(c, Len(c) - v2)
c.Value = Left(c, v1 - 1)
Next c
End Sub

--
Don Guillett
SalesAid Software

"DFIChris" wrote in message
...
Don, Thank you for responding!!!

No, by line I mean a line of text in a cell which has three lines of text,
separated by "Alt Enter."

I've pasted my macro below. Sorry, I should have thought of doing that

from
the start. See where the selection names specific text in the cell and

the
ranges are specific cells names? I'm working toward a generic cut and

paste
macro that I can use down a column of roughly 120 rows.

Sub Macro5()
'
' Macro5 Macro
' Macro recorded 4/20/2005 by CC Dietrich
'
' Keyboard Shortcut: Ctrl+j
'
ActiveCell.FormulaR1C1 = _
"Danai Tsapikidou
------------------ "
With ActiveCell.Characters(Start:=1, Length:=77).Font
.Name = "Tahoma"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = xlAutomatic
End With
Range("P3").Select
ActiveSheet.Paste
Range("O4").Select
End Sub




"Don Guillett" wrote:

As always post your macro for comments. By "line", do you mean row?

--
Don Guillett
SalesAid Software

"DFIChris" wrote in message
...
I canNOT figure out Visual Basic Language. All I want my macro to do

is
to
go to the end of the first line, delete the second line, cut the third

line,
past the third line in the cell to the right of the cell I'm editing,

and
then go to the cell below the cell I was editing.

When I record this macro it only works in the EXACT cells I edited,

not in
any other cells.

Oh help, please.






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
writing macro CN New Users to Excel 2 August 2nd 05 06:16 PM
Need Help writing a macro TwEaKFrEaK[_4_] Excel Programming 1 August 24th 04 10:16 PM
Help writing a macro alldreams Excel Programming 0 June 4th 04 08:24 AM
help in writing a macro slim[_2_] Excel Programming 1 February 13th 04 01:41 AM
Macro Writing Help? Richard[_22_] Excel Programming 2 December 31st 03 07:39 PM


All times are GMT +1. The time now is 06:53 AM.

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

About Us

"It's about Microsoft Excel"