ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Can I make a cell into a macro button? (https://www.excelbanter.com/excel-programming/381455-re-can-i-make-cell-into-macro-button.html)

Don Guillett

Can I make a cell into a macro button?
 
Did you see my post?

--
Don Guillett
SalesAid Software

"carl" wrote in message
...
Hi Gary,

I've tried adding the macro below into a visual basic module but it's not
working. Am I meant to just copy and paste the code into a blank module
or
am I meant to be putting it somewhere else? Apologies for sounding
clueless.

Carl

"Gary''s Student" wrote:

Put this in WorkSheet code:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Cancel = True
If Intersect(Range("A:A"), Target) Is Nothing Then
Else
r = Target.Row
Set r1 = Sheets("d").Range(Cells(r, 1), Cells(r, 7))
Set r2 = Sheets("s").Cells(r, 1)
r1.Copy r2
End If
End Sub

It uses double-click. Double-click on any cell in column A of worksheet
"d"
and the contents of cells A thru G in that row will be automatically
copied
to the same row in worksheet "s".
--
Gary''s Student
gsnu200701


"carl" wrote:

I'm creating a number of worksheets within a workbook. These sheets
have
data that is constantly updated and I often need to take the best line
of
data from each sheet and copy it over to another sheet as a summary of
the
best data from each sheet.

Can I create a macro that is activated each time I click on a cell
rather
than having to create a specific button. It's just that having buttons
doesn't work for what I need.

What I want is to be able to copy say cells A1:G1 to another sheet in
the
work book. But the next time it might be A3:G3. And then the next
time
A5:G5. Plus the tables that I'm copying from are sorted by price or by
date
using other macros so that adds to the complexity. So what I would
like is
to create a macro for each row so that when you click on cell A1 is
will copy
across A1:G1 to the sheet "summary".

The way I've done it up until now is create one single marco button
that
will copy and paste columns A:G on the row that I've highlighted. So
you
have to click on the row tab at the side and then click on the marco
button.
But it causes problems when you click on the marco button without
clicking on
the tab first.

This spreadsheet needs to be simple because it's being used by a lot of
people.




Carl

Can I make a cell into a macro button?
 
Hi Don,

Thanks for your help. I've been away all week. I've tried putting in your
code but it's still not working. Ive also tried Gary's. Obviously you've
called my sheets something different to Gary's so I made sure I was changing
the sheet name each time in the code but it still wasn't doing anything.

Cheers

Carl

"Don Guillett" wrote:

Did you see my post?

--
Don Guillett
SalesAid Software

"carl" wrote in message
...
Hi Gary,

I've tried adding the macro below into a visual basic module but it's not
working. Am I meant to just copy and paste the code into a blank module
or
am I meant to be putting it somewhere else? Apologies for sounding
clueless.

Carl

"Gary''s Student" wrote:

Put this in WorkSheet code:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
Cancel = True
If Intersect(Range("A:A"), Target) Is Nothing Then
Else
r = Target.Row
Set r1 = Sheets("d").Range(Cells(r, 1), Cells(r, 7))
Set r2 = Sheets("s").Cells(r, 1)
r1.Copy r2
End If
End Sub

It uses double-click. Double-click on any cell in column A of worksheet
"d"
and the contents of cells A thru G in that row will be automatically
copied
to the same row in worksheet "s".
--
Gary''s Student
gsnu200701


"carl" wrote:

I'm creating a number of worksheets within a workbook. These sheets
have
data that is constantly updated and I often need to take the best line
of
data from each sheet and copy it over to another sheet as a summary of
the
best data from each sheet.

Can I create a macro that is activated each time I click on a cell
rather
than having to create a specific button. It's just that having buttons
doesn't work for what I need.

What I want is to be able to copy say cells A1:G1 to another sheet in
the
work book. But the next time it might be A3:G3. And then the next
time
A5:G5. Plus the tables that I'm copying from are sorted by price or by
date
using other macros so that adds to the complexity. So what I would
like is
to create a macro for each row so that when you click on cell A1 is
will copy
across A1:G1 to the sheet "summary".

The way I've done it up until now is create one single marco button
that
will copy and paste columns A:G on the row that I've highlighted. So
you
have to click on the row tab at the side and then click on the marco
button.
But it causes problems when you click on the marco button without
clicking on
the tab first.

This spreadsheet needs to be simple because it's being used by a lot of
people.





Don Guillett

Can I make a cell into a macro button?
 
I think we both mentioned the SHEET module instead of a regular module.
Where are you attempting to use?

--
Don Guillett
SalesAid Software

"carl" wrote in message
...
Hi Don,

Thanks for your help. I've been away all week. I've tried putting in
your
code but it's still not working. Ive also tried Gary's. Obviously you've
called my sheets something different to Gary's so I made sure I was
changing
the sheet name each time in the code but it still wasn't doing anything.

Cheers

Carl

"Don Guillett" wrote:

Did you see my post?

--
Don Guillett
SalesAid Software

"carl" wrote in message
...
Hi Gary,

I've tried adding the macro below into a visual basic module but it's
not
working. Am I meant to just copy and paste the code into a blank
module
or
am I meant to be putting it somewhere else? Apologies for sounding
clueless.

Carl

"Gary''s Student" wrote:

Put this in WorkSheet code:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As
Boolean)
Cancel = True
If Intersect(Range("A:A"), Target) Is Nothing Then
Else
r = Target.Row
Set r1 = Sheets("d").Range(Cells(r, 1), Cells(r, 7))
Set r2 = Sheets("s").Cells(r, 1)
r1.Copy r2
End If
End Sub

It uses double-click. Double-click on any cell in column A of
worksheet
"d"
and the contents of cells A thru G in that row will be automatically
copied
to the same row in worksheet "s".
--
Gary''s Student
gsnu200701


"carl" wrote:

I'm creating a number of worksheets within a workbook. These sheets
have
data that is constantly updated and I often need to take the best
line
of
data from each sheet and copy it over to another sheet as a summary
of
the
best data from each sheet.

Can I create a macro that is activated each time I click on a cell
rather
than having to create a specific button. It's just that having
buttons
doesn't work for what I need.

What I want is to be able to copy say cells A1:G1 to another sheet
in
the
work book. But the next time it might be A3:G3. And then the next
time
A5:G5. Plus the tables that I'm copying from are sorted by price or
by
date
using other macros so that adds to the complexity. So what I would
like is
to create a macro for each row so that when you click on cell A1 is
will copy
across A1:G1 to the sheet "summary".

The way I've done it up until now is create one single marco button
that
will copy and paste columns A:G on the row that I've highlighted.
So
you
have to click on the row tab at the side and then click on the marco
button.
But it causes problems when you click on the marco button without
clicking on
the tab first.

This spreadsheet needs to be simple because it's being used by a lot
of
people.







Carl

Can I make a cell into a macro button?
 
Hi Don,

Thanks for getting back to me.

I am right clicking on the sheet tab which takes me through to the "sheet
(code)". I've tried pasting yours and Gary's code in but nothing is working.
I assumed that it was because my sheets weren't called what you had called
them but I'm not sure if that's the case.

From what I can see in the code it doesn't matter what the source sheet is
but the target sheet has to be called "summary" in your code. In Gary's the
soure sheet needs to be "d" and the target sheets needs to be "s".

Is there something else that I'm missing. I feel so close yet so far lol!

Carl

"Don Guillett" wrote:

I think we both mentioned the SHEET module instead of a regular module.
Where are you attempting to use?

--
Don Guillett
SalesAid Software

"carl" wrote in message
...
Hi Don,

Thanks for your help. I've been away all week. I've tried putting in
your
code but it's still not working. Ive also tried Gary's. Obviously you've
called my sheets something different to Gary's so I made sure I was
changing
the sheet name each time in the code but it still wasn't doing anything.

Cheers

Carl

"Don Guillett" wrote:

Did you see my post?

--
Don Guillett
SalesAid Software

"carl" wrote in message
...
Hi Gary,

I've tried adding the macro below into a visual basic module but it's
not
working. Am I meant to just copy and paste the code into a blank
module
or
am I meant to be putting it somewhere else? Apologies for sounding
clueless.

Carl

"Gary''s Student" wrote:

Put this in WorkSheet code:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel
As
Boolean)
Cancel = True
If Intersect(Range("A:A"), Target) Is Nothing Then
Else
r = Target.Row
Set r1 = Sheets("d").Range(Cells(r, 1), Cells(r, 7))
Set r2 = Sheets("s").Cells(r, 1)
r1.Copy r2
End If
End Sub

It uses double-click. Double-click on any cell in column A of
worksheet
"d"
and the contents of cells A thru G in that row will be automatically
copied
to the same row in worksheet "s".
--
Gary''s Student
gsnu200701


"carl" wrote:

I'm creating a number of worksheets within a workbook. These sheets
have
data that is constantly updated and I often need to take the best
line
of
data from each sheet and copy it over to another sheet as a summary
of
the
best data from each sheet.

Can I create a macro that is activated each time I click on a cell
rather
than having to create a specific button. It's just that having
buttons
doesn't work for what I need.

What I want is to be able to copy say cells A1:G1 to another sheet
in
the
work book. But the next time it might be A3:G3. And then the next
time
A5:G5. Plus the tables that I'm copying from are sorted by price or
by
date
using other macros so that adds to the complexity. So what I would
like is
to create a macro for each row so that when you click on cell A1 is
will copy
across A1:G1 to the sheet "summary".

The way I've done it up until now is create one single marco button
that
will copy and paste columns A:G on the row that I've highlighted.
So
you
have to click on the row tab at the side and then click on the marco
button.
But it causes problems when you click on the marco button without
clicking on
the tab first.

This spreadsheet needs to be simple because it's being used by a lot
of
people.







Don Guillett

Can I make a cell into a macro button?
 
The code provided is an example. Change the code to conform to your needs.
If necessary, send me a workbook to the address below and I will take a
look.

--
Don Guillett
SalesAid Software

"carl" wrote in message
...
Hi Don,

Thanks for getting back to me.

I am right clicking on the sheet tab which takes me through to the "sheet
(code)". I've tried pasting yours and Gary's code in but nothing is
working.
I assumed that it was because my sheets weren't called what you had called
them but I'm not sure if that's the case.

From what I can see in the code it doesn't matter what the source sheet is
but the target sheet has to be called "summary" in your code. In Gary's
the
soure sheet needs to be "d" and the target sheets needs to be "s".

Is there something else that I'm missing. I feel so close yet so far lol!

Carl

"Don Guillett" wrote:

I think we both mentioned the SHEET module instead of a regular module.
Where are you attempting to use?

--
Don Guillett
SalesAid Software

"carl" wrote in message
...
Hi Don,

Thanks for your help. I've been away all week. I've tried putting in
your
code but it's still not working. Ive also tried Gary's. Obviously
you've
called my sheets something different to Gary's so I made sure I was
changing
the sheet name each time in the code but it still wasn't doing
anything.

Cheers

Carl

"Don Guillett" wrote:

Did you see my post?

--
Don Guillett
SalesAid Software

"carl" wrote in message
...
Hi Gary,

I've tried adding the macro below into a visual basic module but
it's
not
working. Am I meant to just copy and paste the code into a blank
module
or
am I meant to be putting it somewhere else? Apologies for sounding
clueless.

Carl

"Gary''s Student" wrote:

Put this in WorkSheet code:

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range,
Cancel
As
Boolean)
Cancel = True
If Intersect(Range("A:A"), Target) Is Nothing Then
Else
r = Target.Row
Set r1 = Sheets("d").Range(Cells(r, 1), Cells(r, 7))
Set r2 = Sheets("s").Cells(r, 1)
r1.Copy r2
End If
End Sub

It uses double-click. Double-click on any cell in column A of
worksheet
"d"
and the contents of cells A thru G in that row will be
automatically
copied
to the same row in worksheet "s".
--
Gary''s Student
gsnu200701


"carl" wrote:

I'm creating a number of worksheets within a workbook. These
sheets
have
data that is constantly updated and I often need to take the best
line
of
data from each sheet and copy it over to another sheet as a
summary
of
the
best data from each sheet.

Can I create a macro that is activated each time I click on a
cell
rather
than having to create a specific button. It's just that having
buttons
doesn't work for what I need.

What I want is to be able to copy say cells A1:G1 to another
sheet
in
the
work book. But the next time it might be A3:G3. And then the
next
time
A5:G5. Plus the tables that I'm copying from are sorted by price
or
by
date
using other macros so that adds to the complexity. So what I
would
like is
to create a macro for each row so that when you click on cell A1
is
will copy
across A1:G1 to the sheet "summary".

The way I've done it up until now is create one single marco
button
that
will copy and paste columns A:G on the row that I've highlighted.
So
you
have to click on the row tab at the side and then click on the
marco
button.
But it causes problems when you click on the marco button without
clicking on
the tab first.

This spreadsheet needs to be simple because it's being used by a
lot
of
people.










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

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