Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default Help With Macro Code??

Hi there,

I got this question at work - just wondering if anyone can help me out - i
know the logic, just not the code :(

Im guessing i need to find the cell the mouse is in before i click my
button, then set a variable to this, which will replce the reference to cell
"A3" - code follows:

thanks again....

I have recorded an Excel macro to convert text to columns (using the
Data/Text to Columns command):

Sub text_to_columns()
'
' text_to_columns Macro
' Macro recorded 24/08/2006 by mark.holliday
'

'
Selection.TextToColumns Destination:=Range("A3"),
DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(6, 1), Array(7, 1), Array(18,
1), Array(29, 1), _
Array(39, 1), Array(51, 1), Array(61, 1), Array(78, 1))
End Sub


I have assigned a toolbar button to the macro, and I want to use it to
copy many large blocks of data in text format from the laboratory computer
and put them into columns in Excel. This entails pasting blocks of data
side by side into an Excel worksheet, and using the Text-to-Columns
command each time.

When I recorded the macro, the active cell happened to be A3. When I run
the macro, it always overwrites data into columns starting from cell A3,
irrespective of where I initially paste the text-format data.

How should the macro be written so that the column-reformatted data is
inserted in a block whose top left cell is defined by the currently
selected cell? ie. no overwriting; so that the macro automatically resets
the destination range depending on the currently selected cell?





--
__________________________________________________ ______________

Sponsor me on my Mexico Bike Challenge!
In aid of Cerebral Palsy with Scope
14th - 26th April 2007
Donate He http://www.neilbikemexico.com


  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 10,593
Default Help With Macro Code??

Activecell

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Neil Smith" wrote in message
. uk...
Hi there,

I got this question at work - just wondering if anyone can help me out - i
know the logic, just not the code :(

Im guessing i need to find the cell the mouse is in before i click my
button, then set a variable to this, which will replce the reference to

cell
"A3" - code follows:

thanks again....

I have recorded an Excel macro to convert text to columns (using the
Data/Text to Columns command):

Sub text_to_columns()
'
' text_to_columns Macro
' Macro recorded 24/08/2006 by mark.holliday
'

'
Selection.TextToColumns Destination:=Range("A3"),
DataType:=xlFixedWidth, _
FieldInfo:=Array(Array(0, 1), Array(6, 1), Array(7, 1),

Array(18,
1), Array(29, 1), _
Array(39, 1), Array(51, 1), Array(61, 1), Array(78, 1))
End Sub


I have assigned a toolbar button to the macro, and I want to use it to
copy many large blocks of data in text format from the laboratory

computer
and put them into columns in Excel. This entails pasting blocks of data
side by side into an Excel worksheet, and using the Text-to-Columns
command each time.

When I recorded the macro, the active cell happened to be A3. When I

run
the macro, it always overwrites data into columns starting from cell A3,
irrespective of where I initially paste the text-format data.

How should the macro be written so that the column-reformatted data is
inserted in a block whose top left cell is defined by the currently
selected cell? ie. no overwriting; so that the macro automatically

resets
the destination range depending on the currently selected cell?





--
__________________________________________________ ______________

Sponsor me on my Mexico Bike Challenge!
In aid of Cerebral Palsy with Scope
14th - 26th April 2007
Donate He http://www.neilbikemexico.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
how do I email amacro? leo Excel Worksheet Functions 24 August 9th 06 02:47 PM
Transfer Macro code to another computer Corey Excel Discussion (Misc queries) 0 May 24th 06 11:09 PM
How to see macro code of a password protected macro without a password? Dmitry Kopnichev Excel Worksheet Functions 5 October 27th 05 09:57 AM
Macro for changing text to Proper Case JPriest Excel Worksheet Functions 3 August 8th 05 09:31 PM
macro code shortcut Brian Excel Worksheet Functions 4 December 15th 04 08:59 PM


All times are GMT +1. The time now is 01:50 PM.

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"