Get values from one sheet to the other usind arrays for the addresses

SeniorNewbie

Board Regular
Joined
Jul 9, 2023
Messages
77
Office Version
  1. 2021
  2. 2019
Platform
  1. Windows
  2. MacOS
Hi out there,
I'm fighting with an issue I guessed it's easy to solve. But it isn't. I hope somebody can help.

There are two workbooks. One as source, one as target. My code lays in the target grabbing some cells from the source. Therefor I'm using a xl4-function
VBA Code:
GetValue(sPath, sFile, sSheet, sAdr)
The cell addresses for this function must be defined by A1 naming. The target addresses are not the same and I prefer for that the cells(row,col) naming. So I created two arrays aSource ("A1", "B1") and aTarget("Cells(5,1)", "Cells(7,12)")

The transfer of the data from one workbook to the other works. But the import is just lined up in row(1) of the target and I don't know how to force the data to the correct address. A sample of several attemps:
VBA Code:
sTarget = (aTarget(i))
        Set rng = wb.ActiveSheet.sTarget
        rng = GetValue(sPath, sFile, sSheet, sAdr)
wb = ThisWorkbook

THX in advance for any idea
Senior Newbie
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Ok folks,

finally I solved it by myself:
VBA Code:
        sTarget = (aTarget(i))
        wb.ActiveSheet.Range(sTarget) = GetValue(sPath, sFile, sSheet, sAdr)
and both arrays need the same naming

Sometimes I "do not love" VBA ...
THX anyway!
 
Upvote 0
Solution

Forum statistics

Threads
1,223,948
Messages
6,175,570
Members
452,652
Latest member
eduedu

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