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

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
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,223,239
Messages
6,170,947
Members
452,368
Latest member
jayp2104

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