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

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
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,216,101
Messages
6,128,844
Members
449,471
Latest member
lachbee

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