Assign values "backdoor"

yxz152830

Active Member
Joined
Oct 6, 2021
Messages
393
Office Version
  1. 365
Platform
  1. Windows
Gurus,
Im trying to log some data running vba while doing calculation in the main sheet. Now the thing is that if i wanna log them into another sheet by say sheets("xx").cells(1000,1).end(xlup).offset(1,0) = record, I have to activate the sheet to do so and then activate the main sheet to continue calculation. Is there a way to log the data "backdoor"? Thanks!
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
I have tested with main sheet activate, running the code, sheets"xx" was updated, without activated. main sheet still be active sheet.
If it still does not work for you, could you show the whole code?
 
Upvote 0
I have tested with main sheet activate, running the code, sheets"xx" was updated, without activated. main sheet still be active sheet.
If it still does not work for you, could you show the whole code?
VBA Code:
For Each cell1 In time_slot
        If cell1.Value > 0 Then
        cell1.Value = cell1.Value - ss_rate * (cell1.Value / ss_line_total_interval)
        cell1.Offset(0, 1).Value = cell1.Offset(0, 1).Value + cell1.Value
        End If
        If Cells(cell1.Row, 6).Value <= cell.Value And Cells(cell1.Row, 6).Value >= cell.Offset(0, -1).Value And cell1.Value > 0 Then
        count = count + 1
        record1 = Cells(cell1.Row, 3).Value & " " & "to" & " " & Cells(cell1.Row, 4).Value & " " & "start vol at" & " " & " " & Cells(cell1.Row, 7).Value & " on" & " " & Cells(cell1.Row, 1).Value
        Sheets("SS log").Activate
        Sheets("SS log").Cells(1000, 1).End(xlUp).Offset(1, 0).Value = record1
        Sheets("SS").Activate
        Range(Cells(7, 8), Cells(Cells(7, 1).End(xlDown).Row, 92)).ClearContents
        pri_sum = 0
        End If
Next cell1
 
Upvote 0
try to replace this:.
VBA Code:
Sheets("SS log").Activate
        Sheets("SS log").Cells(1000, 1).End(xlUp).Offset(1, 0).Value = record1
        Sheets("SS").Activate
by this
VBA Code:
'Sheets("SS log").Activate
        Sheets("SS log").Cells(1000, 1).End(xlUp).Offset(1, 0).Value = record1
 '       Sheets("SS").Activate
 
Upvote 0
Solution
try to replace this:.
VBA Code:
Sheets("SS log").Activate
        Sheets("SS log").Cells(1000, 1).End(xlUp).Offset(1, 0).Value = record1
        Sheets("SS").Activate
by this
VBA Code:
'Sheets("SS log").Activate
        Sheets("SS log").Cells(1000, 1).End(xlUp).Offset(1, 0).Value = record1
 '       Sheets("SS").Activate
i don't know why it didnt work... thnkS!
 
Upvote 0

Forum statistics

Threads
1,215,777
Messages
6,126,834
Members
449,343
Latest member
DEWS2031

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