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

SeniorNewbie

Board Regular
Joined
Jul 9, 2023
Messages
71
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

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
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,221,310
Messages
6,159,176
Members
451,543
Latest member
cesymcox

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