move cell to another worksheet

everscern

Board Regular
Joined
Oct 10, 2006
Messages
56
Hi.. sorry to bother you guys again. But VBA is some tedious work.
:confused:

anyway, is there any macro to move the active cell value to another worksheet with a command button?
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Yes, of course:

As long as the command button is on the same sheet as the value of the active cell you want to move over, and replacing my reference to sheet2 range A1 with the reference of your sheet name and the target cell you want the value to go to:

Code:
Private Sub CommandButton1_Click()
Sheets("sheet2").Range("A1").Value = ActiveCell.Value
End Sub
......should do the trick.
 
Upvote 0
is it possible to move it to the next blank cell in a specific column?

for example: column A is for black files, column B for blue files.
A dialog box will ask if its black/blue files. if let's say, it's a blue file, the input value will be placed at column B in the next blank cell.

I'm sorry if it's too complicated. Thanks in advance.
 
Upvote 0
It's not too complicated, but would have been better if you'd asked the whole question in the first place.

We'll use an inputbox to test for black or blue, and the output from that to drive the cell value to the correct place.

Use this code in the commandbutton's click event, in place of the other code:
Code:
Private Sub CommandButton1_Click()
Dim black_col As Integer, blue_col As Integer

black_col = Sheets("sheet2").Range("A65536").End(xlUp).Row + 1
blue_col = Sheets("sheet2").Range("B65536").End(xlUp).Row + 1

test = InputBox("Is this a black or a blue file?" & Chr(10) & "Please type black or blue." & Chr(10) & "Please use lowercase only.", "FILE TYPE CHECK")
    
    If test = "black" Then
        Sheets("sheet2").Range("A" & black_col).Value = ActiveCell.Value
    Else
          Sheets("sheet2").Range("B" & blue_col).Value = ActiveCell.Value
    End If
    
End Sub
 
Upvote 0

Forum statistics

Threads
1,213,527
Messages
6,114,144
Members
448,552
Latest member
WORKINGWITHNOLEADER

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