2
Contributors
12
Replies
13
Views
4 Years
Discussion Span
Last Post by krishnisilva
0

is this access or excel you are talking about

this is in excel i am talking about

0

this is in excel i am talking about

if you go to Deleloper Tab there is a way to add textbox i am tring to write a macro to copy data from another sheet (a range of data) and paste it to the textbox how do i do it?

0

the simplest way is to go to Tools -> Macro -> Record New Macro
manually do what want, the macro will create the VBA for you, you can then go into the Visual Basic editor to look at, improve the code.

0

the simplest way is to go to Tools -> Macro -> Record New Macro
manually do what want, the macro will create the VBA for you, you can then go into the Visual Basic editor to look at, improve the code.

yes i did that but when i do that the macro dosen't record when i paste the content to the textbox, because text box dosen't have a method paste

0
Dim contents As String
contents = ""
For Each c In Worksheets("Sheet2").Range("a1:a4").Cells
  contents = contents & ", " & c.Value
Next c
TextBox1.Text = contents
0
Dim contents As String
contents = ""
For Each c In Worksheets("Sheet2").Range("a1:a4").Cells
  contents = contents & ", " & c.Value
Next c
TextBox1.Text = contents

thnaks for the help
i did that, but the only thing is can't get the format of the data range that i an putting to the textbox,
how can i do that?

0

There is a format$ function that will format things for you. for example for a money amount

contents = format$(c.value,"currency")
0

There is a format$ function that will format things for you. for example for a money amount

contents = format$(c.value,"currency")

so if i have a format as


A $5.00 $7.00 $2.00
B $(5.00) $(9.00) $6.00
C $8.00 $(8.00) $(4.00)
D $2.00 $(9.00) $7.00

so i have something like above how to i display exactly the same way in the textbox?

0

yes i looked at it
but the range i am going to copy it has number string $ amount so can't format into one format right
how can i do this

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.