locked
VBA Excel Select Only some data from a Cell RRS feed

  • Question

  • Hi

    I am trying to create a text box that will only pick up some of the data that is in a cell. 

    For example the data in the cell is a follows.

    Attention: someone@something.com

    In my text box i want it to take out the "attention" and just show the email address "Someone@somthing.com.

    Can someone help? 

    Friday, January 18, 2013 7:30 PM

All replies

  • You need to use two cells.  If the first cell (say A1) contains:

    Attention: someone@something.com

    Then in A2 enter:

    =MID(A1,13,9999)

    and reference A2 in the TextBox


    gsnu201301



    Friday, January 18, 2013 8:27 PM
  • Fantastic, 

    However is there a way to do it in VBA for example this is my code at present

    email = ActiveCell.Offset(0, 10)

    Is there VBA code to strip out the "Attention:" section before it is applied to the text box?

    Friday, January 18, 2013 8:47 PM
  • Yes......but I would not assign a formula to the TextBox.   Instead I would get the string from the target cell, modify it, and place the modification directly into the TextBox.

    gsnu201301

    Friday, January 18, 2013 9:15 PM