Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Covert Excel Formula to Workbook

Posted on 2011-03-11
4
Medium Priority
?
300 Views
Last Modified: 2012-05-11
Hi Experts,

Can someone show me how I would go about applying the following excel code to a workbook. At the moment it applies to a worksheet called 2 Bull Up 3 Bear Dwn 2 Bull Up, but I would like to be able to apply globally on all worksheets.

Sub zolumn()
   With Sheets("2 Bull Up 3 Bear Dwn 2 Bull Up")
      .Range("B2", .Cells(.Rows.Count, "B").End(xlUp)).ClearContents
   End With
End Sub

Cheers
0
Comment
Question by:cpatte7372
  • 3
4 Comments
 
LVL 81

Accepted Solution

by:
zorvek (Kevin Jones) earned 2000 total points
ID: 35112890
Sub zolumn()
   Dim Worksheet As Worksheet
   For Each Worksheet In ThisWorkbook.Worksheets
       With Worksheet
           .Range("B2", .Cells(.Rows.Count, "B").End(xlUp)).ClearContents
       End With
   Next Worksheet
End Sub

Kevin
0
 

Author Comment

by:cpatte7372
ID: 35115571
Kev,

Thanks man......
0
 

Author Comment

by:cpatte7372
ID: 35115652
Kev/Experts,

Can someone please also convert the following globally across the workbook as Kevin did above?

Sub Part1()
    Dim lastrow As Long
   
    lastrow = Sheets("Stocks").Range("A" & Rows.Count).End(xlUp).Row
   
    Sheets("Stocks").Range("A1:A" & lastrow).Copy _
    Sheets("Four Lows Five High").Range("B1")
End Sub

Cheers
0
 

Author Closing Comment

by:cpatte7372
ID: 35115958
Cheers
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
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!
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

916 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