Command button help

Posted on 2012-09-17
Medium Priority
Last Modified: 2012-09-17
Private Sub CommandButton3_Click()

      Range("B2").Value = Date - Weekday(Date, 3)
      Range("B3").Value = Date - Weekday(Date, 3) + 4

End Sub

If B2 equals the first monday of last week & B3 Friday

How do I alter the code so I get the first Monday of the current week?

i.e 17th & 21st
Question by:Kiwi-123
LVL 10

Accepted Solution

SANTABABY earned 1000 total points
ID: 38407695
Date - Weekday(Date, vbMonday) + 1
LVL 22

Assisted Solution

CompProbSolv earned 1000 total points
ID: 38407705
Does this work for you?
Range("B2").Value = Date - Weekday(Date+1, 3)+1

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

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