hi ,

i have a textbox control in one sheet and a range of data in another sheet in the same file. how do i copy the range of data in paste it in the textbox control?

appreciate a reply thanks

Re: textbox control 80 80

is this access or excel you are talking about

Re: textbox control 80 80

is this access or excel you are talking about

this is in excel i am talking about

Re: textbox control 80 80

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?

Re: textbox control 80 80

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.

Re: textbox control 80 80

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

Re: textbox control 80 80
Dim contents As String
contents = ""
For Each c In Worksheets("Sheet2").Range("a1:a4").Cells
  contents = contents & ", " & c.Value
Next c
TextBox1.Text = contents
Re: textbox control 80 80
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?

Re: textbox control 80 80

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

contents = format$(c.value,"currency")
Re: textbox control 80 80

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?

Re: textbox control 80 80

have you looked at the Help for format$ that should tell you

Re: textbox control 80 80

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

Re: textbox control 80 80

hi do you know a way of doing it????

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.