D
D
Danila2021-11-03 07:31:58
Macros
Danila, 2021-11-03 07:31:58

With which macro from one Excel sheet to add cell values ​​to other sheets in a specific cell?

Good day! I can't figure out how to write a macro. The task and conditions are as follows:
61820d179460f104499099.png

There is a document with several sheets. They are numbered from 1 to 10. Before these sheets there is another sheet with general information. In the screenshot, it is highlighted as active. On it we see a table of the usual format, numbered in accordance with the sheets in the document. For example, for 1 position in the general sheet "price list" there is basic data for any person. And on sheet "1" there is already detailed information about him.

You need a formula or a macro that does the following:
mass transfer from the sheet "price list" column B (value in the line) to the sheet corresponding to the serial number in the table in a specific cell (for example, D4). In this case, the cell should not change, but should remain fixed, but the values ​​\u200b\u200bthat we transfer (for example, from the entire column B) should be arranged according to the number sheet. Those. if No. 1 - PP, then on sheet "1" in cell D4 there should be an inscription "PP". If this is the next No. 2 - PC, then on sheet "2" in cell D4 - the inscription "PC"

Help, please, I'm still not rummage in VBA. But I understand that logically there should be an operator that is assigned the value 1 and then counts up to the last line (No.) on the "price list" sheet and then each time adding +1 puts in the corresponding sheet and cell the value from this first sheet. There should probably be a cycle here.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton, 2021-11-17
@KJhas

Sub Populate()
Dim ce As Excel.Range
For Each ce In Worksheets("Price").Range("B1:B10").Cells
Worksheets(ce.Offset(0, -1).Text).Range("$ D$4") = ce.Value
Next
End Sub

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question