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

I have a generic MACRO question. I undestand the relative/absolut
principle. However, when using the "Record a new macro" option, an
set the macro to Relative, it does not appear to be repeating the sam
key stokes I typed.

Example-
Say I have a column of text and I want to delete the second characte
of each cell. I clicked Record amacro, set to relative, then keyed:

Edit, Home, Right, Delete, Enter

Then stopped recording. If my original column is:

Dog
Cat
Mouse

I want

Dg
Ct
Muse

But I get
Dg
Dg
Dg

Thanks,
SK

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default Relative Macro Assignment

Hi,

Whatever you do when you are in cell edit mode is *not* recorded by the macro
recorder, just the result when you press Enter, so what you get is 'Enter "Dg"
in the cell', *not* 'delete the second character in the cell'.

Try the following macro, it deletes the second character in each selected cell,
assuming the selected cells contain text strings. You can change Selection to
any range.

'-----
Option Explicit

Sub test637()
Dim cCell As Range
For Each cCell In Selection
With cCell
.Value = Left(.Value, 1) & Mid(.Value, 3)
End With
Next
End Sub
'-----

HTH
Anders Silven

"esskaykay " skrev i meddelandet
...
I have a generic MACRO question. I undestand the relative/absolute
principle. However, when using the "Record a new macro" option, and
set the macro to Relative, it does not appear to be repeating the same
key stokes I typed.

Example-
Say I have a column of text and I want to delete the second character
of each cell. I clicked Record amacro, set to relative, then keyed:

Edit, Home, Right, Delete, Enter

Then stopped recording. If my original column is:

Dog
Cat
Mouse

I want

Dg
Ct
Muse

But I get
Dg
Dg
Dg

Thanks,
SKK


---
Message posted from http://www.ExcelForum.com/


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Relative Macro Assignment

Thanks for your response Anders.

What I really wanted to know was 'why do I lose my routine afte
entering the Edit mode?' (you answered that). I remember the old Lotu
macro language where you could enter commands directly as the macr
code. Too bad that's gone, particularly for us non-VB progammers.
realize how much more powerful VBA is, however most of the things
want to antomate could be done with simple key stroke commands. O
well, that's progress...

Thanks again,
SK

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default Relative Macro Assignment

Hi again,

Thanks for the feedback. Hope you find a way to get on.

Regards
Anders Silven

"esskaykay " skrev i meddelandet
...
Thanks for your response Anders.

What I really wanted to know was 'why do I lose my routine after
entering the Edit mode?' (you answered that). I remember the old Lotus
macro language where you could enter commands directly as the macro
code. Too bad that's gone, particularly for us non-VB progammers. I
realize how much more powerful VBA is, however most of the things I
want to antomate could be done with simple key stroke commands. Oh
well, that's progress...

Thanks again,
SKK


---
Message posted from http://www.ExcelForum.com/


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
The Relative Macro DanP Excel Discussion (Misc queries) 6 March 17th 09 02:58 PM
relative value in macro Janett Excel Discussion (Misc queries) 2 April 4th 06 05:42 PM
Relative Values in a Macro DGernand Excel Programming 2 April 8th 04 12:46 AM
Macro assignment to button gets reassigned John Gittins Excel Programming 1 August 5th 03 10:18 PM
relative ref. macro J.E. McGimpsey Excel Programming 0 July 28th 03 05:03 PM


All times are GMT +1. The time now is 12:10 AM.

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"