Using the test sheet I uploaded as example: Test.xlsm
Divide values in data sheet 1 and 2, which have different number of rows, by 1000.
The 'Goal' sheet is just for illustration, the vba code should work the code in the actual data sheets itself.
Using the test sheet I uploaded as example: Test.xlsm
Divide values in data sheet 1 and 2, which have different number of rows, by 1000.
The 'Goal' sheet is just for illustration, the vba code should work the code in the actual data sheets itself.
Last edited by webcam723; 07-20-2023 at 04:36 AM.
Try below code:
PHP Code:
Option Explicit
Sub divide()
Dim lCell As Range, ws As Worksheet, rng As Range
For Each ws In Sheets
If ws.Name = "Data Sheet 1" Or ws.Name = "Data Sheet 2" Then
Set lCell = ws.Cells(Rows.Count, "L").End(xlUp)
Set rng = ws.Range("E2", lCell)
rng.Value = Evaluate("='" & ws.Name & "'!" & rng.Address & "/ 1000")
End If
Next
End Sub
Quang PT
This works perfectly. Thank you for ur help!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks