Enter formula in a range across all sheets

nickisokay

New Member
Joined
Jun 18, 2019
Messages
3
Hello,
I have a userform where someone can enter a multiplying factor (exchange rate).
I want to use this number to multiply the contents of a range of cells (A1:A100) across all visible sheets.
Can you help please!
Thanks,
Nick
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
Something like this will work. The multiplier will be a textbox text on the userform.

Code:
Dim sh As Worksheet, arr, multiplier As Double

multiplier = 45

For Each sh In ThisWorkbook.Worksheets
    If sh.Visible = True Then
        arr = sh.Range("A1:A100")
        For i = 1 To 100
            If Not IsEmpty(arr(i, 1)) And IsNumeric(arr(i, 1)) Then
                arr(i, 1) = arr(i, 1) * multiplier
            End If
        Next
        sh.Range("A1:A100") = arr
    End If
Next
 
Upvote 0

Forum statistics

Threads
1,214,649
Messages
6,120,732
Members
448,987
Latest member
marion_davis

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