VBA: how to write in the same cell of a different sheet

Nelson78

Well-known Member
Joined
Sep 11, 2017
Messages
526
Office Version
  1. 2007
Hello everybody.

I'm getting crazy with something that looks very easy.

I've a cycle like this:


VBA Code:
For Each cell In rec.Range("A2:A" & lr)

...

cell.Offset(0, counter).Value = cell2.Offset(0, 5).Value

...

Next cell

Now, I've to write the value
VBA Code:
cell2.Offset(0, 5).Value
in
VBA Code:
cell.Offset(0, counter).Value
(and this part is ok), but also in the same cell of a different sheet, say

VBA Code:
Dim cent As Worksheet
    Set cent= ThisWorkbook.worksheets("Centralised")

How can i figure this out?
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Hi Nelson78,

maybe one way to handle this:

VBA Code:
Dim wksCent As Worksheet
Dim rngCell As Range

Set wksCent = ThisWorkbook.Worksheets("Centralised")
'...
For Each rngCell In rec.Range("A2:A" & lr)
  wksCent.Range(rngCell.Offset(0, 5).Address).Value = rngCell.Value
Next rngCell
'...

Ciao,
Holger
 
Upvote 0

Forum statistics

Threads
1,215,487
Messages
6,125,082
Members
449,205
Latest member
Healthydogs

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