ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   A macro to paste values (https://www.excelbanter.com/excel-discussion-misc-queries/158532-macro-paste-values.html)

Matthew

A macro to paste values
 
In Excel we use a lot of formulas that link to our database and not everyone
who gets the excel sheets has the database. I want to write a macro that will
select every sheet in the workbook, select all cells and paste values. But
because the sheet names and the number of them are usually different i need
it to know to pick all the sheets availanle? Can anyone help with the
coding?!?

Gary''s Student

A macro to paste values
 
Sub noform()
For Each ws In Worksheets
ws.Select
Cells.Copy
Cells.PasteSpecial Paste:=xlPasteValues
Next
End Sub

will remove all formulas in the worksheets
--
Gary''s Student - gsnu200745


"Matthew" wrote:

In Excel we use a lot of formulas that link to our database and not everyone
who gets the excel sheets has the database. I want to write a macro that will
select every sheet in the workbook, select all cells and paste values. But
because the sheet names and the number of them are usually different i need
it to know to pick all the sheets availanle? Can anyone help with the
coding?!?


Bob Phillips

A macro to paste values
 
For Each sh In Activeworkbook.Worksheets
sh.Range("A1").Copy 'as an example
'...
Next sh

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Matthew" wrote in message
...
In Excel we use a lot of formulas that link to our database and not
everyone
who gets the excel sheets has the database. I want to write a macro that
will
select every sheet in the workbook, select all cells and paste values. But
because the sheet names and the number of them are usually different i
need
it to know to pick all the sheets availanle? Can anyone help with the
coding?!?





All times are GMT +1. The time now is 08:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com