Macros

purceld2

Well-known Member
Joined
Aug 18, 2005
Messages
586
Office Version
  1. 2013
Platform
  1. Windows
iI have a Workbook which has about 7 sheet in it. I have created a macro which reformats cells in the spreadsheet. The problem is the range is different in each sheet. Basically the macro either needs to be tailored for each spreadsheet or intelligent to detect what spreadsheet it is and apply the appropriate range.

Has anyone got a easy solution to my problem?

Can macro be attached to individual spreadsheet in a workbook?
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
If there is a pattern to the different ranges, like the last ROW or something, then it would be a simple fix.

If it is always the same range, but a different range on each sheet that does not change then the Select Case structure and a For Next loop will do.

If at any one time the cells that get worked upon are different and their is no pattern or algorithm to the pattern of change, then no.

Give more information for a better answer!
 
Upvote 0
Dim lngMyBotR&
Dim ws As Object

For Each ws In Worksheets
lngMyBotR = ws.Range("A65536").End(xlUp).Row

ws.Range(Cells(lngMyBotR, 1), Cells(ingMyBotR, 5)).Select

Selection."Here is where you put what you want to do to the last row on any sheet, columns A through E"

Next ws
 
Upvote 0
I think I have posed the question right i will try again i am reformatting range AD13;Ax13 to AD17:ax17 in one sheet but in the other it's Ad13;ax13 to ad52;ax52 so in the first sheet when the macro is run it formats cells that i do not want it to.

i hope i have made the question clearer
 
Upvote 0
What is the actual range to be formatted on each sheet, knowing that each sheet will have different cells in the formmating range. If these change on any given sheet at any time once the code is set, how does it change?
 
Upvote 0

Forum statistics

Threads
1,214,968
Messages
6,122,509
Members
449,089
Latest member
RandomExceller01

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