Search results

  1. B

    VBA - If range value = "date" then

    Just so you know how my brain is working atm ill explain my thought process on the code I just posted. lines 2,3 & 4 to my understanding are defining the D/M/Y as integers and setting the initial month as 3. 4,5,6,7, & 8 are the pre proven lines for selecting the initial worksheet...
  2. B

    VBA - If range value = "date" then

    Airtight this is my best crack at it. Private Sub Workbook_Open() Dim intMonth As Integer, intDay As Integer, intYear As Integer Dim strDate As String intMonth = Month(3) Sheets("LongStayPermit").Select Columns("M:M").Select ActiveSheet.Range("$M$1:$M$244").AutoFilter Field:=1...
  3. B

    VBA - If range value = "date" then

    The lists I am creating are for the dates that parking permits, issued this year, expire. To clarify the info in Column M:M that I am filtering is the parking permits expiry date. So if they were issued this year the date I am trying to find will be this time next year.
  4. B

    VBA - If range value = "date" then

    Okey this is what I got: Private Sub Workbook_Open() Dim intMonth As Integer, intDay As Integer, intYear As Integer Dim strDate As String intYear = Year(2019) For intMonth = 1 To 12 strDate = DateSerial(2019, 3 + 1, 0) Debug.Print strDate Sheets("LongStayPermits").Select...
  5. B

    VBA - If range value = "date" then

    I have inserted it at the head of the code I posted before, it now looks like this: Dim intMonth As Integer, intDay As Integer, intYear As Integer Dim strDate As String intYear = Year(2018) For intMonth = 1 To 12 strDate = DateSerial(intYear, intMonth + 1, 0) Debug.Print strDate Next...
  6. B

    VBA - If range value = "date" then

    The lines: Sheets("LongStayPermits").Select ActiveSheet.Range("$M$1:$M$244").AutoFilter Field:=1 Were taken from the recorder. It is simply me navigating back to the starting page and opening the filters out to include every date. I'm interested in your suggestion of creating a loop...
  7. B

    VBA - If range value = "date" then

    Cracked it. I accidently put a space in the name of July easy done. Any ideas on how to refine and improve would be appreciated but as of right now its working fine for my purposes. I put in this line as well to send me back to the start page and remove the filters...
  8. B

    VBA - If range value = "date" then

    Me again, i'm now attempting to refine the code for use in a spread sheet that covers every month of the year. I Know it is not the most elegant way or the quickest way but at this stage i'm just trying to get it to work. Here is what I came up with so far: Private Sub Workbook_Open()...
  9. B

    VBA - If range value = "date" then

    You were right :D I simply used the Cells.Select after filtering to move all the info that I needed. Will be no problem replicating it for every month of the year now and getting it to run on start up. A long walk for a short drink of water, but thanks for your patience, still building my...
  10. B

    VBA - If range value = "date" then

    Ill give it a go. I think im making headway as ive got the filtering side down now I used the recorded and it gave me this back: Sub Macro2() ' ' Macro2 Macro ' ' Columns("M:M").Select Selection.AutoFilter ActiveSheet.Range("$M$1:$M$244").AutoFilter Field:=1, Criteria1:= _...
  11. B

    VBA - If range value = "date" then

    Thanks, Ill muddle through what's here so far and see if I cant wrap my head around it and try get something working.
  12. B

    VBA - If range value = "date" then

    Thanks for the advice. I did try and record a macro at the start as you suggested and that is where I got the lines of code for selection of the columns, copying, sheet selection and pasting. The part that I am struggling with as you know is the filtering as the recording gave me absolutely...
  13. B

    VBA - If range value = "date" then

    Alright I got it working, to the point where it would find and copy dates (but not the whole row), small progress but progress none the less... right before Excel crashed :banghead: I have replicated the code I had when it was working: Sub Macro1() Columns("M:M").Select If...
  14. B

    VBA - If range value = "date" then

    It now looks like this: Sub Info_Transfer() Dim Cell As Range Range ("M4:M244") If Len(Cell.Value) >= 0 And Format(Cell.Value, "ddmmyyyy") = "31032019" Then Row.Select Selection.Copy Sheets("March").Select ActiveSheet.Paste End If End Sub Next Cell I have had to add...
  15. B

    VBA - If range value = "date" then

    Unfortunately there is no access side of this database it is all from Excel. Simply put all im trying to do is move information to a different sheet should the date in the cell correspond with a pre-set date. Any ideas on how I could do this would be appreciated.
  16. B

    VBA - If range value = "date" then

    Tried that, I just get a Type mismatch error for: If Range("M2:M244") = #3/31/2019# Then
  17. B

    VBA - If range value = "date" then

    Hi all, I'm new to VBA and trying to use it to make my job a bit easier while learning something new. The problem I am working at the moment is trying to get certain rows of my Excel sheet copied in to a different sheet automatically if a value in a certain range is the correct date. Here...
Back
Top Bottom