+ Reply to Thread
Results 1 to 2 of 2

how do you convert units when you copy values from one sheet to another

  1. #1
    Registered User
    Join Date
    07-09-2019
    Location
    India
    MS-Off Ver
    2018
    Posts
    5

    Post how do you convert units when you copy values from one sheet to another

    Hello people,

    I am working on some programming where I have to transfer values from one sheet to another sheet. I am facing some issue.

    * sheet which I am working is template I just need to transfer values from source sheet to target sheet which I am able to do but issue is I need to change units (SI unit etc etc ). when I transfer values I want to transfer converted values.
    so can any body help me with any solution please thank you

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,819

    Re: how do you convert units when you copy values from one sheet to another

    You ask how I would do it, but I would not use VBA for this task. When I do something like this, I set up the spreadsheet to use Excel's built in CONVERT() function (https://support.office.com/en-us/art...d-666c810f9af2 ). At the top of my input column, I enter the "from unit" text and paste the data into this column. In the adjacent column, I have the "to unit" text at the top of this column, then I have the to unit column filled with the formula =CONVERT(A2,$A$1,B$1). When I have a new set of data to convert, it is as simple as entering/pasting the new data into the from unit column and changing the units text in the top row.

    If I were required to use VBA for this task (maybe because I will receive a large bonus for using as few spreadsheet columns as possible), I would consider looping through each input value and performing the conversion before writing to the spreadsheet. I could also see using VBA to paste into a simple spreadsheet like I describe above, the paste/write the resulting values from the from unit column into the destination sheet. I could see writing a VBA procedure based on the .PasteSpecial method (https://docs.microsoft.com/en-us/off...e.pastespecial ) where I use the pastespecial method to multiply the pasted data by the correct conversion factor.

    What kind of approach would you like to take? What questions do you have about implementing that approach?
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Convert units and units of measure
    By AntiPivotTable in forum Excel General
    Replies: 1
    Last Post: 10-21-2016, 07:22 PM
  2. Convert Minutes to Individual Units
    By pmickey13 in forum Excel General
    Replies: 1
    Last Post: 07-27-2010, 07:31 PM
  3. How to convert units from pre-existing values
    By kennechiwa87 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-08-2010, 05:45 PM
  4. Convert combined units?
    By Dr.Ile in forum Excel General
    Replies: 11
    Last Post: 06-29-2010, 06:39 AM
  5. How to convert units within a cell
    By WS6FirebirdTA00 in forum Excel General
    Replies: 13
    Last Post: 12-17-2007, 11:50 AM
  6. [SOLVED] convert units
    By luiss in forum Excel General
    Replies: 4
    Last Post: 02-20-2006, 05:50 PM
  7. How do I convert a time units
    By jeff excel in forum Excel General
    Replies: 3
    Last Post: 02-08-2005, 05:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1