How do I paste a value from VBA in to a cell in excel workbook 
Author Message
 How do I paste a value from VBA in to a cell in excel workbook

How do I paste a value from VBA in to a cell in Excel workbook.

I want to paste the value of FirstName in to B2?

        Range("A3").Select
        MyName = Range("A3").Text  ' Create text string.
        FirstName = Trim(Mid(MyName, 1, 22))
        Range("B2").Select

Paste function???

        Thx for taking the time to help me.

Micke



Mon, 12 Apr 2004 20:22:41 GMT  
 How do I paste a value from VBA in to a cell in excel workbook
 Range("B2").Value = Trim(Mid(Range("A3").Text, 1, 22))

--
Jim Rech
Excel MVP



Mon, 12 Apr 2004 20:27:31 GMT  
 How do I paste a value from VBA in to a cell in excel workbook
Micke,

Range("B2").Value = FirstName

BTW, you don't need to select the ranges A3 to get its
value, or B2 to set its value.

Ian Megaw



Mon, 12 Apr 2004 20:46:08 GMT  
 How do I paste a value from VBA in to a cell in excel workbook


Quote:
> How do I paste a value from VBA in to a cell in Excel workbook.

> I want to paste the value of FirstName in to B2?

>         Range("A3").Select
>         MyName = Range("A3").Text  ' Create text string.
>         FirstName = Trim(Mid(MyName, 1, 22))
>         Range("B2").Select

> Paste function???

>         Thx for taking the time to help me.

> Micke



Mon, 12 Apr 2004 21:07:52 GMT  
 How do I paste a value from VBA in to a cell in excel workbook
How can i, in a IF statement, do different things depending on if FirstName
is a nummeric or letter value.

MyName = Range("A3").Text
FirstName = Trim(Mid(MyName, 1, 22))

If  FirstName (Is letter, not numbers)

Then
Range("B2").Value = FirstName

Else
Range("A3").Select
Selection.Delete Shift:=xlUp

Thx
/Micke



Mon, 12 Apr 2004 21:23:51 GMT  
 How do I paste a value from VBA in to a cell in excel workbook
Micke,

If Application.IsNumber(FirstName) Then

Range("A3").Delete Shift:=xlUp

Else

Range("B2").Value = FirstName

End If

Ian Megaw



Tue, 13 Apr 2004 00:10:53 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Copy a value of a cell and paste it to another workbook

2. Using VBA to select a highlighted range and paste values to another workbook

3. Insert cell value from one workbook to cell in another workbook

4. copy sheets to new workbook, name new workbook by cell value then mail workbook

5. syntax for cell value on sheet A = cell value workbook B

6. Pasting Range from Excel 2002 via VBA to Word causes a New Workbook to open

7. Excel VBA :Paste into visible cells

8. Pasting formulas into cells from VBA into Excel

9. excel copy&paste formulas from workbook to workbook

10. output specific cells in workbook to a new workbook using vba


 
Powered by phpBB® Forum Software © phpBB Group