VBA button to put value of cells in another cell

CraigG

Board Regular
Joined
May 1, 2005
Messages
169
Office Version
  1. 365
  2. 2007
Platform
  1. Windows
  2. Mobile
In Sheet1 I have values in A2:A91.

In Sheet2 I want to add VBA code which when run shows the value of Sheet1.A2 in Sheet2.B2, but when run a second time it shows the value of Sheet1.A3 in Sheet2.B2, then when run a third time it shows the value of Sheet1.A4 in Sheet2.B2, etc, etc, right up to until Sheet1.A91 has been displayed.

Anyone any ideas?

Thanks in advance.
 

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Try this:
Code:
Sub FromSheet1ToSheet2()
Dim R As Range
Static Cycle As Long
Set R = Sheet1.Range("A2:A91")
Cycle = Cycle + 1
If Cycle > R.Rows.Count Then Cycle = 0
With Sheet2.Range("B2")
    .Value = R.Cells(Cycle, 1).Value
End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,236
Messages
6,123,798
Members
449,127
Latest member
Cyko

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