?
Solved

Macro Copy

Posted on 2011-10-28
20
Medium Priority
?
174 Views
Last Modified: 2012-06-27
Hello,

I try to write macro for dynamic copy.
I have a table in first sheet
Sheet name , Cell ,Value
I need a macro to copy a value depend on   a sheet name and  Cell
Thanks


Test.xlsm
0
Comment
Question by:samprg
  • 11
  • 9
20 Comments
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 37048779
Your request is not clear nor is the sample file. What I understand from them is that you want to collect the value from the given sheet and cell address to the value column. If this is the case then use this formula in D5 and copy it down

=INDIRECT(B5&"!"&C5)

On row 5 this will give the value of cell C5 on sheet DP
On row 5 this will give the value of cell Y3 on sheet HR

The source cells should have some value in them otherwise it will display 0.
0
 

Author Comment

by:samprg
ID: 37048799
I need a macro copy a value and put it in the other sheet
for eg.
copy a value =Y*4 in sheet DP cell  C5, then second value,third,......
test.JPG
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 37048816
Try this macro

Sub copybyshtcel()
Dim sws As Worksheet, cel As Range
Set sws = Sheets("Main")
For Each cel In sws.Range("B5:B" & sws.Range("B5").End(xlDown).Row)
Sheets(cel.Value).Range(cel.Offset(0, 1)).Formula = cel.Offset(0, 2).Formula
Next cel
End Sub
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:samprg
ID: 37048823
I try to update all the sheets from one sheet by macro,
0
 

Author Comment

by:samprg
ID: 37048832
ssaqibh:
Very Good.
Can ask you other question ? or I need to open a new question.
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 37048833
Go ahead
0
 

Author Comment

by:samprg
ID: 37048837
I need a macro to calculate all the sheets
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 37048842
??
0
 

Author Comment

by:samprg
ID: 37048844
I need to hit F9 for all the sheets but I prefer to Calculate
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 37048851
I still do not understand what you want.

If you have automatic calculation on then you do not have to press F9

If you have automatic calculation off then you all sheets will be calculated if you press F9
0
 

Author Comment

by:samprg
ID: 37048860
Yes,
But I need it for other reason
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 37048863
I have to understand what you need before I can help you.
0
 

Author Comment

by:samprg
ID: 37048872
I hit F9 for calculation but I have many sheets.
So I need a macro to hit F9 or make calculation for all of the sheets
0
 

Author Comment

by:samprg
ID: 37048876
does this work   ?
Dim Current As Worksheet
   
   For Each Current In Worksheets
Calculate
     
      End With
     
   Next



0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 37048890
You do not need to do it separately for all sheets. Hit F9 once and it will calculate "ALL" sheets.

Alternatively you can have

Application.calculate

anywhere in the code and it will calculate "ALL" sheets.

0
 

Author Comment

by:samprg
ID: 37048894
So the macro be Just  Application.calculate

0
 
LVL 43

Accepted Solution

by:
Saqib Husain, Syed earned 2000 total points
ID: 37048911
Yes
0
 

Author Closing Comment

by:samprg
ID: 37048923
Awesome & Excellent
0
 
LVL 43

Expert Comment

by:Saqib Husain, Syed
ID: 37048935
samprg, althought it does not make any difference pointwise to me on this question but please bear this in mind whenever closing a question.

These questions become part of Expert Exchange's knowledge base which is available to the rest of the world. One of the purpose of accepting a solution is to highlight it so that anyone accessing the knowledgebase should not have to go through each comment and can directly go to the accepted answer which is definitely a working solution.

In this case you should have selected the second post given by me.

Anyway thanks for the points and the grade and happy coding.

Saqib
0
 

Author Comment

by:samprg
ID: 37050162
OK, next time
Thanks
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question