ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Command Button to copy conetents of one cell to another (https://www.excelbanter.com/excel-programming/346096-command-button-copy-conetents-one-cell-another.html)

Gazzauk2000

Command Button to copy conetents of one cell to another
 
Basically, i have a table of customers details, and i need to make a command
button using VB code or anything else that will allow me to slect the ID of a
customer, and the details of the custoemr to be insrted into other cells on a
different sheet (which is an estimate and invoice ). Any help please?

Ron de Bruin

Command Button to copy conetents of one cell to another
 
Hi Gazzauk2000

You can use DataAutoFilter to filter on your ID and then copy the Visible cells

Sub Copy_with_Autofilter()
Dim rng As Range

With ActiveSheet.AutoFilter.Range
On Error Resume Next
Set rng = .Offset(1, 0).Resize(.Rows.Count - 1, 1) _
.SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If Not rng Is Nothing Then rng.EntireRow.Copy _
Sheets("Sheet2").Range("A1")
End With
End Sub



Try this to copy the activecell row to Sheets("Sheet2").Range("A1")

Sub copy_6()
Dim destrange As Range
If Selection.Areas.Count 1 Then Exit Sub
Set destrange = Sheets("Sheet2").Range("A1")
ActiveCell.EntireRow.Copy destrange
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Gazzauk2000" wrote in message ...
Basically, i have a table of customers details, and i need to make a command
button using VB code or anything else that will allow me to slect the ID of a
customer, and the details of the custoemr to be insrted into other cells on a
different sheet (which is an estimate and invoice ). Any help please?




Gazzauk2000

Command Button to copy conetents of one cell to another
 
This does not work. What i need is a combo-box that allows you to select a
custoemrs ID, then it copies the custoemr information which is currently in
an excel spreadsheet onto the estimate which is on the next sheet. However
information from different columns go into different cells on the estimate. I
may have to show you what i mean, do you have msn messenger?

"Ron de Bruin" wrote:

Hi Gazzauk2000

You can use DataAutoFilter to filter on your ID and then copy the Visible cells

Sub Copy_with_Autofilter()
Dim rng As Range

With ActiveSheet.AutoFilter.Range
On Error Resume Next
Set rng = .Offset(1, 0).Resize(.Rows.Count - 1, 1) _
.SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If Not rng Is Nothing Then rng.EntireRow.Copy _
Sheets("Sheet2").Range("A1")
End With
End Sub



Try this to copy the activecell row to Sheets("Sheet2").Range("A1")

Sub copy_6()
Dim destrange As Range
If Selection.Areas.Count 1 Then Exit Sub
Set destrange = Sheets("Sheet2").Range("A1")
ActiveCell.EntireRow.Copy destrange
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Gazzauk2000" wrote in message ...
Basically, i have a table of customers details, and i need to make a command
button using VB code or anything else that will allow me to slect the ID of a
customer, and the details of the custoemr to be insrted into other cells on a
different sheet (which is an estimate and invoice ). Any help please?





Ron de Bruin

Command Button to copy conetents of one cell to another
 
Hi Gazzauk2000

Send me your example workbook private and I look at it

--
Regards Ron de Bruin
http://www.rondebruin.nl


"Gazzauk2000" wrote in message ...
This does not work. What i need is a combo-box that allows you to select a
custoemrs ID, then it copies the custoemr information which is currently in
an excel spreadsheet onto the estimate which is on the next sheet. However
information from different columns go into different cells on the estimate. I
may have to show you what i mean, do you have msn messenger?

"Ron de Bruin" wrote:

Hi Gazzauk2000

You can use DataAutoFilter to filter on your ID and then copy the Visible cells

Sub Copy_with_Autofilter()
Dim rng As Range

With ActiveSheet.AutoFilter.Range
On Error Resume Next
Set rng = .Offset(1, 0).Resize(.Rows.Count - 1, 1) _
.SpecialCells(xlCellTypeVisible)
On Error GoTo 0
If Not rng Is Nothing Then rng.EntireRow.Copy _
Sheets("Sheet2").Range("A1")
End With
End Sub



Try this to copy the activecell row to Sheets("Sheet2").Range("A1")

Sub copy_6()
Dim destrange As Range
If Selection.Areas.Count 1 Then Exit Sub
Set destrange = Sheets("Sheet2").Range("A1")
ActiveCell.EntireRow.Copy destrange
End Sub


--
Regards Ron de Bruin
http://www.rondebruin.nl


"Gazzauk2000" wrote in message ...
Basically, i have a table of customers details, and i need to make a command
button using VB code or anything else that will allow me to slect the ID of a
customer, and the details of the custoemr to be insrted into other cells on a
different sheet (which is an estimate and invoice ). Any help please?








All times are GMT +1. The time now is 01:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com