Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 16
Default Please help with this... using a marco to modify cells

What i want to do is make a marco that changes or adds units to a cell, that
allows the userer to enter the units desired.(by inputbox)

heres what i was trying, but i can get it to work

Dim x As String
x = ActiveCell.Formula
y = InputBox("What units do you want to input?", ("Unit Type?"), " CY")
x = "=" & x & " " & y
ActiveCell.Formula = x

origonally i had
x = ActiveCell.value
y = InputBox("What units do you want to input?", ("Unit Type?"), " CY")
x = "=" & x & " " & y
ActiveCell.value = x

but this took the number and not ther equasion so that further changes on
the sheet didnt update the column.

i recorded a macro doing this and it didnt help me much.
Please help!


Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,365
Default Please help with this... using a marco to modify cells

First of all, in setting X you probably need to use
X = ActiveCell.Value
rather than the formula. If it has a formula (or gets one when you use it
once) then the formula will already have an = symbol as part of it.

When you add the user input value to things, then it's going to change it
all to a string in the cell, so future math using it will have to be created
specially to deal with it, and it will get touchy to use (depending on
whether or not you've added some units identifier to it)
Assuming the cell in question is A1, then the piece to deal with it and use
it as a value in a formula you'd need something like
IF(FIND(" ",A1)1,VALUE(LEFT(A1,FIND(" ",A1)-1)),A1)
so a formula to multiply that value by 2 would look like
=IF(FIND(" ",A1)1,VALUE(LEFT(A1,FIND(" ",A1)-1)),A1) * 2

"CSUS_CE_Student" wrote:

What i want to do is make a marco that changes or adds units to a cell, that
allows the userer to enter the units desired.(by inputbox)

heres what i was trying, but i can get it to work

Dim x As String
x = ActiveCell.Formula
y = InputBox("What units do you want to input?", ("Unit Type?"), " CY")
x = "=" & x & " " & y
ActiveCell.Formula = x

origonally i had
x = ActiveCell.value
y = InputBox("What units do you want to input?", ("Unit Type?"), " CY")
x = "=" & x & " " & y
ActiveCell.value = x

but this took the number and not ther equasion so that further changes on
the sheet didnt update the column.

i recorded a macro doing this and it didnt help me much.
Please help!


Thanks!

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
Stop auto modify of copied cells Eric Excel Discussion (Misc queries) 3 June 11th 07 10:54 PM
modify a macro to apply to a specific range of cells Dave F Excel Discussion (Misc queries) 2 April 25th 07 03:00 AM
How do I modify range of cells viewed in HTML format? Colli Excel Discussion (Misc queries) 0 March 15th 05 02:45 PM
Modify Row & Cell Contents based upon Cells Values bpat1434 Excel Worksheet Functions 0 November 7th 04 03:31 PM
Modify Row & Cell Contents based upon Cells Values bpat1434 Excel Worksheet Functions 1 November 6th 04 05:17 PM


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