#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default macros

Hello

I have simple problem with a simple keyboard macro.
I am coping from internet banking and pasting banking
statements in excel. Unfortunately, the numbers are in
text format because the coping inserts a space infront of
all the numbers. I have tried functions to remove the
space. No luck. so I pressed the following key sequence;
f2, home, delete, enter. Great the leading space is gone.
I then go to record a keyboard macro with same key
storkes. It does not work. What happeens when I run the
macro is that number in the cell where I made the macro is
copied to all other cells. For example:

if the number in a cell is 29.99 and I record the macro
with the above key stokeds and run it in another cell it
copies 29.99 in all the cells. Can anyone tell me what is
wrong. Also, I looked at the macro the keystorkes, they
are wrong. For some reason Excel is not recording
keystorkes properly. Any help is apprecaited. Please
reply to . Thank you all.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 16
Default macros

I think what happen is when you record the Macro, it only works with that
particular cell. What you need to do is change the cell reference to
Activecell
e.g. in your macro code, it might appear range(CELL ADDRESS).select for
example, replace with activecell.value

I wrote a some code which may help try and see if it helps.

Option Explicit
Dim myRange As Range
Dim counter As Long
Dim myValue As Double

Sub Convert()

Dim myCells As Long

Set myRange = Range("b2:c8")
myCells = myRange.Count

counter = 1
Do Until counter = myCells + 1
On Error Resume Next
Call doit
counter = counter + 1
Loop
End Sub
Sub doit()
myValue = myRange.Item(counter).Value
myRange.Item(counter).Value = myValue
End Sub


"Rajan Rai" wrote in message
...
Hello

I have simple problem with a simple keyboard macro.
I am coping from internet banking and pasting banking
statements in excel. Unfortunately, the numbers are in
text format because the coping inserts a space infront of
all the numbers. I have tried functions to remove the
space. No luck. so I pressed the following key sequence;
f2, home, delete, enter. Great the leading space is gone.
I then go to record a keyboard macro with same key
storkes. It does not work. What happeens when I run the
macro is that number in the cell where I made the macro is
copied to all other cells. For example:

if the number in a cell is 29.99 and I record the macro
with the above key stokeds and run it in another cell it
copies 29.99 in all the cells. Can anyone tell me what is
wrong. Also, I looked at the macro the keystorkes, they
are wrong. For some reason Excel is not recording
keystorkes properly. Any help is apprecaited. Please
reply to . Thank you all.



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
Excel 2007 macros - how to merge 5 macros together into one Sue Excel Discussion (Misc queries) 1 April 16th 08 08:36 PM
Macros warning always shows up, even if all macros removed Joe M Excel Discussion (Misc queries) 1 December 20th 07 04:45 AM
Macros - copying macros from one computer to another TT Excel Discussion (Misc queries) 18 December 14th 06 03:24 AM
Training: More on how to use macros in Excel: Recording Macros ToriT Excel Worksheet Functions 2 February 10th 06 07:05 PM
List the Macros that can be executed from Tools-Macros Rob Bovey Excel Programming 1 July 10th 03 05:34 PM


All times are GMT +1. The time now is 04:01 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"