ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro to change data in a sheet (https://www.excelbanter.com/excel-discussion-misc-queries/85890-macro-change-data-sheet.html)

Diana

Macro to change data in a sheet
 
I have two sheets in my workbook. One is the main sheet with radio buttons
that I am assigning macros to and the other sheet is the data sheet. What I
would like to do is to whenever I check the radio button data in specific
cells on a second sheet changes without actually showing that sheet. Every
single time the radio button is selected data in a second sheet changes and
the sheet appears with the changed data. I want the data to change but the
sheet should remain hidden. Is there a way to do this.

Thanks

Casey

Macro to change data in a sheet
 

Diane,
I'm not an expert and your post was a little vague, but this might give
you a starting place.

Option Explicit

Private Sub OptionButton1_Click()

Dim wks As Worksheet
Set wks = Worksheets("Data") '<=====Change name as needed
If OptionButton1.Value = True Then
wks.Range("A1") = 100
End If
End Sub

Private Sub OptionButton2_Click()
Dim wks As Worksheet
Set wks = Worksheets("Data") '<=====Change name as needed
If OptionButton2.Value = True Then
wks.Range("A1") = 50
End If
End Sub


--
Casey


------------------------------------------------------------------------
Casey's Profile: http://www.excelforum.com/member.php...fo&userid=4545
View this thread: http://www.excelforum.com/showthread...hreadid=537308



All times are GMT +1. The time now is 02:47 PM.

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