copy active cell to same cell in sheet 2.

stavrosiona

New Member
Joined
Apr 17, 2015
Messages
22
I want to copy active cell if sheet 1 to same cell in sheet 2 by using vba button. Active cell is not the same each time.
I use: Range (sheet1!a2).value = range(sheet2!a2) but this does 9nly for the cell a2 and not the active cell each time.
 
Sorry. Now i saw his answer. Wait to test.
Basically what i want is not to copy the same cell but basically to understand:
Wgen i click i.e cell C1 and press the vba button then i want to add+1 in cell C1 in sheet2. So if cell C1 in sheet 2 value is 5. When i press button when active cell c1 sheet 1 then to change the value of sheet2 cell c1 to be 6
 
Upvote 0

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
if you want the VBA code for the button1_click
Code:
Sub Button1_Click()
Dim a1 As String
a1 = Selection.Address(ReferenceStyle:=xlA1, RowAbsolute:=False, ColumnAbsolute:=False)
Sheets("Sheet1").Range(a1) = Sheets("Sheet2").Range(a1)
End Sub
 
Upvote 0
  • DILIPandey that works! Thanks,I want to ask if it is possible now instead of copy the cell value of sheet1 to sheet 2 cell value to add+1 in the value that sheet2 already have. So if i am in cell c1 in sheet 1, to use the vba to add+1 in the value of cell C1 in sheet 2. So if sheet 2 value is 5, when i press the vba button in cell c1 in sheet1 to +1 cell c1 in sheet 2. From 5 to be 6.Thanks
 
Upvote 0
Hello, stavrosiona
in my code, you can
Code:
[COLOR=#333333]Sheets("Sheet1").Range(a1) = Cint(Sheets("Sheet2").Range(a1).value) +1[/COLOR]
 
Last edited:
Upvote 0
Try this:
Code:
Range("Sheet2!" & ActiveCell.Address).Value = ActiveCell.Value + 1

This is DILIPandey code but adds +1
 
Last edited:
Upvote 0
May i ask you a question guys?
Instead of preset to add +1 if i want when i press the button to ask me to: "Enter value you want to add" and then add a value in a box and add it?
 
Upvote 0

Forum statistics

Threads
1,215,473
Messages
6,125,018
Members
449,203
Latest member
tungnmqn90

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top