Name an Excel cell with a macro
Gégé123
-
Mike-31 Posted messages 18405 Registration date Status Contributor Last intervention -
Mike-31 Posted messages 18405 Registration date Status Contributor Last intervention -
Hello everyone,
I’m not very familiar with VB language but I want to use Excel macros to save time, as I have several repetitive tasks to perform on different files:
- 1st request:
I want to name cell C2 (for example C2 = 'Toto') via macro.
- 2nd request:
I want to perform a calculation for several columns of the table.
For all the columns in my sheet, I take the value in A31 and subtract it from the value in A1 (B31-B1, C31-C1...)
I want to incorporate these two requests into one macro.
Thank you very much for your help.
I’m not very familiar with VB language but I want to use Excel macros to save time, as I have several repetitive tasks to perform on different files:
- 1st request:
I want to name cell C2 (for example C2 = 'Toto') via macro.
- 2nd request:
I want to perform a calculation for several columns of the table.
For all the columns in my sheet, I take the value in A31 and subtract it from the value in A1 (B31-B1, C31-C1...)
I want to incorporate these two requests into one macro.
Thank you very much for your help.
3 answers
Hello,
to name a cell or range
Range("C2").Name = "toto"
to sum the range B1 to D100 from another sheet
[A1] = [Sum(Sheet1!B1:D100)]
if the cells are on the same sheet we can shorten the code
[A1] = [Sum(B1:D100)]
or the sum of several ranges
[A1] = [Sum(B1:B31,D1:D31)]
A+
Mike-31
A period of failure is an ideal time to sow the seeds of knowledge.
to name a cell or range
Range("C2").Name = "toto"
to sum the range B1 to D100 from another sheet
[A1] = [Sum(Sheet1!B1:D100)]
if the cells are on the same sheet we can shorten the code
[A1] = [Sum(B1:D100)]
or the sum of several ranges
[A1] = [Sum(B1:B31,D1:D31)]
A+
Mike-31
A period of failure is an ideal time to sow the seeds of knowledge.