View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Susan Susan is offline
external usenet poster
 
Posts: 1,117
Default Selecting 10 charcters on one cell and pasting to another cell

my mistake (didn't work) - just the "10" gives an error & should be
"+10", but that doesn't work. that line should be

myString = Left(TargetCell.Text, 10)

sorry!
(excuse me if this comes thru 2x, is giving me troubles)
susan


On Feb 23, 9:44 am, "Susan" wrote:
on 2nd thought, i don't think chris' does what you want it to, because
he's taking the value of the active cell instead of column d.
however, i found a bug in mine, that it only works properly if the
target cell is 16 characters.
so i think it'd be better to go from the right.

myString = right(TargetCell.Value, Len(TargetCell) 10)

susan

On Feb 23, 9:34 am, "Susan" wrote:



this is what i came up with:


Option Explicit


Private Sub CommandButton1_Click()


Dim CurrentRow As Long
Dim TargetCell As Range
Dim myString As String
Dim DestCell As Range


CurrentRow = ActiveCell.Row


Set TargetCell = Range("d" & CurrentRow)


myString = Left(TargetCell.Value, Len(TargetCell) - 6)


Set DestCell = Range("h" & CurrentRow)


DestCell = myString


End Sub


but Chris' is much simpler.
oh well. :)
susan


On Feb 23, 8:44 am, wrote:


Hi,
For example, I am working on cell G8. I would like to set up a button
that, once clicked, copies and pastes the first 10 characters from D8
and pastes it into H8. The same process would apply if I am on G33,
i.e.copy first 10 characters from D33 and paste into H33, etc, etc.


I can't figure it out.


Can someone help?
Tony- Hide quoted text -


- Show quoted text -- Hide quoted text -


- Show quoted text -