Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all 50094 articles
Browse latest View live

Find and Replace Macro

$
0
0
Hi Guys,

I have a macro as per below;

Quote:

Sub Multi_FindReplace()
'PURPOSE: Find & Replace a list of text/values throughout entire workbook

Dim sht As Worksheet
Dim fndList As Variant
Dim rplcList As Variant
Dim x As Long

fndList = Array("Wk 14", "Wk 15", "Wk 16", "Wk 17", "Wk14", "Wk15", "Wk16", "wk17")
rplcList = Array("Wk 18", "Wk 19", "Wk 20", "Wk 21", "Wk18", "Wk19", "Wk20", "wk21")

'Loop through each item in Array lists
For x = LBound(fndList) To UBound(fndList)
'Loop through each worksheet in ActiveWorkbook
For Each sht In ActiveWorkbook.Worksheets
sht.Cells.Replace What:=fndList(x), Replacement:=rplcList(x), _
LookAt:=xlPart, SearchOrder:=xlByRows, MatchCase:=False, _
SearchFormat:=False, ReplaceFormat:=False
Next sht

Next x

End Sub
This runs through a monthly workbook and updates values found within multiple formulas to the next month. My question however relates to the exclusion of a 5th week to the data. I believe there are 4, five week months this year. Is there a way I can accommodate this in my macro? Particularly if the formula that the above changes goes from requiring four values to five and vice versa. I can add the formula to the relevant cells, extending it to include 5 weeks of data where necessary but is there a way to do it, without manually adjusting the 4 & 5 week spreadsheets.

the formula example is below.
Quote:

4 WEEKS =IF($J$2="Wk 18",VLOOKUP(J5,'[Oliver Adams Weekly KPI''s - 2016.xlsx]Wk18'!$A:$I,9,0),IF($J$2="Wk 19",VLOOKUP(J5,'[Oliver Adams Weekly KPI''s - 2016.xlsx]Wk19'!$A:$I,9,0),IF($J$2="Wk 20",VLOOKUP(J5,'[Oliver Adams Weekly KPI''s - 2016.xlsx]Wk20'!$A:$I,9,0),IF($J$2="Wk 21",VLOOKUP(J5,'[Oliver Adams Weekly KPI''s - 2016.xlsx]Wk21'!$A:$I,9,0),"Check"))))
Quote:

5 WEEKS =IF($J$2="Wk 18",VLOOKUP(J5,'[Oliver Adams Weekly KPI''s - 2016.xlsx]Wk18'!$A:$I,9,0),IF($J$2="Wk 19",VLOOKUP(J5,'[Oliver Adams Weekly KPI''s - 2016.xlsx]Wk19'!$A:$I,9,0),IF($J$2="Wk 20",VLOOKUP(J5,'[Oliver Adams Weekly KPI''s - 2016.xlsx]Wk20'!$A:$I,9,0),IF($J$2="Wk 21",VLOOKUP(J5,'[Oliver Adams Weekly KPI''s - 2016.xlsx]Wk21'!$A:$I,9,0),IF($J$2="Wk 22",VLOOKUP(J5,'[Oliver Adams Weekly KPI''s - 2016.xlsx]Wk22'!$A:$I,9,0),"Check")))))

Using CHARACTERS on cell with formula

$
0
0
Hi all,

I want to use the CHARACTERS in VBA on a cell that has a formula in it.
Is that possible?

Let's say I use the code below and put in A1 the value of 24 and in A2:
="A"&2*A1&"B"

Cell A2 then shows 'A48B' (as expected), but the code below does not highlight the number in red (which I expected it to do).
If I just type 'A48B' in a random cell, it does work fine. Does anyone have any bright ideas? :)

Code:

Private Sub Worksheet_Change(ByVal Target As Range)
Dim cell As Range, chcell As Range, ch1 As Long, ch2 As Long, keyw1 As String, keyw2 As String
keyw1 = "A"
keyw2 = "B"

For Each cell In ActiveSheet.UsedRange
If Not chcell Is Nothing Then chcell.Characters(ch1 + 1, ch2 - ch1).Font.ColorIndex = 3: Set chcell = Nothing
If InStr(cell, keyw1) = 0 Then GoTo nxc
Set chcell = cell


ch1 = InStr(cell, keyw1)
ch2 = InStr(cell, keyw2) - (ch1)


nxc:
Next cell
If Not chcell Is Nothing Then chcell.Characters(ch1 + 1, ch2).Font.ColorIndex = 3: Set chcell = Nothing


End Sub

Enable macros not working in shared environment.

$
0
0
Hi There,

I have the age old problem where I have a workbook full of macros and Active X controls which used to work and now is not working properly.

There are hundreds of people who access a template from a shared link on our Corporate network. Now, when they access it, it does not request 'enable macros', but if they access it on their local desktop, it asks them to enable macros.

I am on the corporate network, and can access all the macros, but it doesn't prompt me to enable macros.

I made some changes to the protection of the document mainly the following:

Code:

ActiveSheet.Protect UserInterfaceOnly:=True, Password:="123"
up until last Thursday, everyone could access it without issue. now, no matter what I try, it does not ask to enable macros and no one can access the functionality.

any help you could provide would be gratefully received.

Unfortunately, I cannot share the template due to sensitivity.

Many thanks in advance.

Autofilter 2 criteria

$
0
0
Hi guys
the below code works a treat, to filter "loaded" before copying all other entries to another sheet, but I need to filter on 2 criteria "loaded" and "Stock Destroyed", I have tried a few things, but cannot seem to get it to work by omitting both criteria before it copies to another sheet, both the criteria are in the same field

any help would be appreciated

scouse13


Code:

Sub Update24hrSun()

'Calls Message showing Please Wait, while code is running
MessageAlert.Show False
DoEvents

Sheets("Summary").Unprotect
Sheets("Lostloadssun").Unprotect
Application.ScreenUpdating = False
Application.EnableEvents = False
'Application.Calculation = xlCalculationAutomatic
Application.CommandBars("Worksheet Menu Bar").Controls("Edit").Enabled = True
        Application.CommandBars("Worksheet Menu Bar").Controls("File").Enabled = True
        Application.CommandBars("Worksheet Menu Bar").Controls("View").Enabled = True
        Application.CommandBars("Worksheet Menu Bar").Controls("Insert").Enabled = True
        Application.CommandBars("Worksheet Menu Bar").Controls("Format").Enabled = True
        Application.CommandBars("Worksheet Menu Bar").Controls("Tools").Enabled = True
        Application.CommandBars("Worksheet Menu Bar").Controls("Data").Enabled = True
        Application.CommandBars("Worksheet Menu Bar").Controls("Window").Enabled = True
        Application.CommandBars("Worksheet Menu Bar").Controls("Help").Enabled = True


Dim lngLastRow As Long
Dim LostSheet As Worksheet
Set LostSheet = Sheets("Lostloadssun") ' Set This to the Sheet name you want all On Hold's going to
'Set ErrorSheet = Sheets("LostloadsMon") ' Set this to the Sheet name you want all Error's going to

lngLastRow = Cells(Rows.Count, "A").End(xlUp).Row

Sheets("Lostloadssun").Unprotect
With Range("A4", "R" & lngLastRow)
    .AutoFilter
    .AutoFilter Field:=18, Criteria1:="<>*Loaded*"------------------ HERE(have tried adding another criteria like this)
    .Offset(1).Copy LostSheet.Range("A5")
    .AutoFilter
   
    lngLastRow = Cells(Rows.Count, "A").End(xlUp).Row
   
  ActiveWorkbook.Save
 
End With

Unload MessageAlert

Application.ScreenUpdating = True

MsgBox ("Data Saved to 24HR Report")

Application.CommandBars("Worksheet Menu Bar").Controls("Edit").Enabled = False
Application.CommandBars("Worksheet Menu Bar").Controls("File").Enabled = False
Application.CommandBars("Worksheet Menu Bar").Controls("View").Enabled = False
Application.CommandBars("Worksheet Menu Bar").Controls("Insert").Enabled = False
Application.CommandBars("Worksheet Menu Bar").Controls("Format").Enabled = False
Application.CommandBars("Worksheet Menu Bar").Controls("Tools").Enabled = False
Application.CommandBars("Worksheet Menu Bar").Controls("Data").Enabled = False
Application.CommandBars("Worksheet Menu Bar").Controls("Window").Enabled = False
Application.CommandBars("Worksheet Menu Bar").Controls("Help").Enabled = False

Sheets("Lostloadssun").Select
Range("y39").Select
Sheets("Lostloadssun").Protect

End Sub

Searching Within Cells and copying to a list

$
0
0
Hi.

I have some code, see below which runs well. It has a Dropdown = "ComboBox1" with header columns and a search box "TextBox1"

It only searches the beginning of the data in the cell. How could it be modified to search within the cell.

For example if I have a dropdown of Address and the data is 123 High Street, London. and I search for London in won't match because the cell starts with 123.

Any Help?

Code:

Private Sub UserForm_Initialize()
 ComboBox1.List = WorksheetFunction.Transpose(Sheets("SiteList").Range("A1:G1"))

 
End Sub

Private Sub textbox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
   
        Dim DataSH As Worksheet
        Set DataSH = Sheets("SiteList")
        DataSH.Range("L1").Value = ComboBox1.Value
        DataSH.Range("L2").Value = TextBox1.Text
        DataSH.Range("A1").CurrentRegion.AdvancedFilter Action:=xlFilterCopy, criteriarange:=DataSH.Range("L1:L2"), copytorange:=DataSH.Range("N1:T1")
               
               
        On Error Resume Next
        ListBox1.RowSource = "SiteList!" & DataSH.Range("outdata").Address
       
        If Err <> 0 Then MsgBox "Data not found.", vbExclamation
   
End Sub

PowerPoint table and charts linked to excel updates by VBA

$
0
0
Dear friends,
I have one excel file (Excel Template) and one Presentation file (Presentation Template Macro). The idea is to…

---Open Excel file -> update the data -> save -> close it.
---Then open powerpoint -> run VBA code -> update the presentation (which is linked to the excel)

Problem: Code updates the first slide properly from sheet1 but the second slide is not getting updated. The code I have used is not mine. Can anyone please let me know why slide 2 is not getting updated?

For your reference i have uploaded the two files
(Sorry i used third party to upload the file, as in my browser i was not able to upload the file directly in the Post)
http://s000.tinyupload.com/?file_id=...90137459088195

Here is the code used to update the presentation:
Code:

Option Explicit

Sub UpDateLinks()
    '~~> Powerpoint Variables/Objects
    Dim ofd As FileDialog
    Dim initDir As String
    Dim OldSourcePath As String, NewSourcePath As String

    '~~> Excel Objects
    Dim oXLApp As Object, oXLWb As Object

    '~~> Other Variables
    Dim sPath As String, OldPath As String, sFullFileOld As String
    Dim oldFileName As String, newFileName As String

    'Set the initial directory path of File Dialog
    initDir = "C:\"

    '~~> Get the SourceFullName of the chart. It will be something like
    '  C:\MyFile.xlsx!Sheet1![MyFile.xlsx]Sheet1 Chart 1
    OldSourcePath = ActivePresentation.Slides(1).Shapes(1).LinkFormat.SourceFullName

    Set ofd = Application.FileDialog(msoFileDialogFilePicker)

    With ofd
        .InitialFileName = initDir
        .AllowMultiSelect = False

        If .Show = -1 Then
            '~~> Get the path of the newly selected workbook. It will be something like
            '  C:\Book2.xlsx
            sPath = .SelectedItems(1)

            '~~> Launch Excel
            Set oXLApp = CreateObject("Excel.Application")
            oXLApp.Visible = True

            '~~> Open the Excel File. Required to update the chart's source
            Set oXLWb = oXLApp.Workbooks.Open(sPath)

            '~~> Get the path "C:\MyFile.xlsx" from
            '~~> say "C:\MyFile.xlsx!Sheet1![MyFile.xlsx]Sheet1 Chart 1"
            OldPath = Split(OldSourcePath, "!")(0)

            '~~> Get just the filename "MyFile.xlsx"
            oldFileName = GetFilenameFromPath(OldPath)
            '~~> Get just the filename "Book2.xlsx" from the newly
            '~~> Selected file
            newFileName = GetFilenameFromPath(.SelectedItems(1))

            '~~> Replace old file with the new file
            NewSourcePath = Replace(OldSourcePath, oldFileName, newFileName)

            'Debug.Print NewSourcePath

            '~~> Change the source and update
            ActivePresentation.Slides(1).Shapes(1).LinkFormat.SourceFullName = NewSourcePath
            ActivePresentation.Slides(1).Shapes(1).LinkFormat.Update
            DoEvents

            '~~> Close Excel and clean up
            oXLWb.Close (False)

            Set oXLWb = Nothing
            oXLApp.Quit
            Set oXLApp = Nothing
        End If
    End With

    Set ofd = Nothing
End Sub

Public Function GetFilenameFromPath(ByVal strPath As String) As String
    If Right$(strPath, 1) <> "\" And Len(strPath) > 0 Then
        GetFilenameFromPath = _
        GetFilenameFromPath(Left$(strPath, Len(strPath) - 1)) + Right$(strPath, 1)
    End If
End Function

[SOLVED] With Statement . Assignment to multiple objects

$
0
0
Hi it´s me again....

I have multiple Combo boxes in a form named like ComBox1a, ComboBox2a, ..., ComBox13a.

All of them should display the same options just like in the example below for ComboBox1a :

With ComboBox1a

.AddItem "Relais, Schütze"
.AddItem "Klemmen"
.AddItem "Stecker"
.AddItem "Umformer"
.AddItem "Schutzeinrichtungen"
.AddItem "Meldeeinrichtungen"
.AddItem "Motoren"
.AddItem "Messgeräte, Prüfeinrichtungen"
.AddItem "Sensorik, Schalter und Taster"
.AddItem "Transformatoren"
.AddItem "Spannungsquelle und Generator"
.AddItem "Induktivitäten"
.AddItem "SPS"
.AddItem "Kabel / Verbindungen",

End With

Is there any way rather then assigning manually the .AddItem to each object (ComBox1a, ComboBox2a, ..., ComBox13a) in the series?

Thanks in advance for your tips,
Ruben

Returning multiple txt Substrings and using them as search term

$
0
0
Hi Guys,

I've attached an example of a document I need some help with. I've tried a ton of different things but keep getting stuck.

I'm trying to search for string(s) of text in a cell, extract them into a single cell as headers then use them as a search term to return info from elsewhere in the work book.

Hopefully the attached demonstrates what I need to achieve, I've tried to keep it as simple as possible.

This is well beyond my ability to conceive but I should be ok to run with it if someone can give me a starting point?

Thanks a lot
Attached Files

[SOLVED] Insert Row and Add Text to new cell of Inserted Row

$
0
0
I want to insert a row based on the cell value above and add text to the cell of this newly added row (and loop through all the rows within the range).

The code I have will loop through the range and insert a row, but how can I have it add text as well. In the inserted Row, I would like to add text to it...like "My Newly Added Row"
Thanks!

Code:

Sub AddRowData()
Dim r As Range
Set r1 = Range("A1:A1000")
    For Each r In r1
    If r.Value = "InsertNewRowBelow" Then
    r.Offset(1, 0).Rows.Insert
    End If
        Next r
 End Sub

Allocation of columns to other sheet based on matching headers

$
0
0
Hi everyone,

In the attached template I have 3 sheets. All tables have the same headers but in some sheets there are more columns than in others. Basically, I would like to match the headers in the InfoPath Import sheets with those in the Final Layout sheet, so that it only copies over the columns that match with the headers in the Final Layout. The headers in the InfoPath Import sheet are not always at the same position but they always have the same name as the ones in the Final Layout sheet.

Many thanks for your help.


P.S.: Posted this question on this forum too.

VBA Loop Through a certain level of subfolder

$
0
0
I found this code from somewhere online (did not test before), now I am testing the code, and it does not work.

I use "Step Over" button to test the code line by line, when the code executes the line "Call DoOneFile(fl.Path)", but the code cannot actually go into "Private Sub DoOneFile(sFullFileName As String)". The code just goes through "Call DoOneFile(fl.Path)" and does nothing and move to next file.

weird....



Code:

Const sRootFolder As String = "C:\MrExcel\"

Sub test()

    Call MAINroutine(sRootFolder)

End Sub

Private Sub MAINroutine(sSourceFolder As String)

    Set fldr = CreateObject("scripting.filesystemobject").Getfolder(sSourceFolder)
   
    For Each fl In fldr.Files
      If Right(fl.Name, 4) = ".txt" Then
        Call DoOneFile(fl.Path)
      End If
    Next

    For Each SubFolder In fldr.SubFolders
        MAINroutine SubFolder.Path
    Next

End Sub

Private Sub DoOneFile(sFullFileName As String)

    If LevelsDeep(sRootFolder, sFullFileName) = 3 Then
   
        Debug.Print sFullFileName
   
    End If

End Sub

Function LevelsDeep(sHigherFolder As String, sLowerFolder As String) As Integer

    If InStr(1, sLowerFolder, sHigherFolder, 1) = 1 Then
   
        LevelsDeep = UBound(Split(Right(sLowerFolder, Len(sLowerFolder) - Len(sHigherFolder)), "\"))
       
    Else
   
        LevelsDeep = 0
   
    End If

End Function

Long Formula Getting 1004 error when running VBA

$
0
0
I am trying to insert a formula into a cell as part of a Macro and it keep giving my a 1004 error but I can't figure out why. Any help would be greatly received. code below

ActiveCell.FormulaR1C1 = _
"=((((SUMIFS(Data!C5,Data!C13,RC3,Data!C1,"">=""&R4C3,Data!C1,""<=""&R4C4,Data!C19,R5C))/R19C)*(SUMIFS(Data!C5,Data!C13,""Other Leave"",Data!C1,"">=""&R4C3,Data!C1,""<=""&R4C4,Data!C19,R5C)))+((((SUMIFS(Data!C5,Data!C13,RC3,Data!C1,"">=""&R4C3,Data!C1,""<=""&R4C4,Data!C19,R5C))/R19C)*(SUMIFS(Data!C5,Data!C13,""Holiday"",Data!C1,"">=""&R4C3,Data!C1,""<=""&R4C4,Data!C1" & _
"+((((SUMIFS(Data!C5,Data!C13,RC3,Data!C1,"">=""&R4C3,Data!C1,""<=""&R4C4,Data!C19,R5C))/R19C)*(SUMIFS(Data!C5,Data!C13,""Sick Leave"",Data!C1,"">=""&R4C3,Data!C1,""<=""&R4C4,Data!C19,R5C)))+(SUMIFS(Data!C5,Data!C13,RC3,Data!C1,"">=""&R4C3,Data!C1,""<=""&R4C4,Data!C19,R5C)))))"

save one dimensional array to a range

$
0
0
Can anyone tell me why this particular function doesn't work as a formula on a spreadsheet but it works fine in the immediate window?

Public Function test() As String

Range("A1:A3").Value = Application.WorksheetFunction.Transpose(Array("Apple", "Banana", "Orange"))

test = "Completed"

End Function

Combobox1 take just first value

$
0
0
dear All,
i have userform contains combobox1, and other comboboxes and textboxes, the combobox1 list equal cities in the range "G7:to last non empty cell") in the sheet name countries, i was able to choose any value from drop down list of combobox1 and all things was OK, suddenly when i choose any value of combobox1 list it take just the first value ie , if i choose the city Rom from drop down list like this " 1-paris ,2-beirut ,3-istanbul ,4-Rom , 5-Berline ... etc" combobox1 return city Paris , why ??
what is the wrong ??
i use this code below , also this code is for match spelling letters :


Option Explicit
Dim Cities

Private Sub UserForm_Initialize()
With Sheets("countries ").Range("A7").CurrentRegion
Cities = .Offset(1).Resize(.Rows.Count - 1).Value2
End With
With ComboBox1
.MatchEntry = fmMatchEntryNone
.ColumnCount = UBound(Cities, 2)
.List = Cities
End With
End sub


Private Sub ComboBox1_Change()
Dim x As Long, y As Long
Dim key, matchedlist
Dim matches As Object
If Len(Me.ComboBox1.Text) = 0 Then
ComboBox1.List = Cities
Exit Sub
End If
Set matches = CreateObject("scripting.dictionary")
For x = LBound(Cities) To UBound(Cities)
Dim temp As String
For y = LBound(Cities, 2) To UBound(Cities, 2)
temp = temp & Cities (x, y) & "|"
Next y
temp = Left(temp, Len(temp) - 1)
If InStr(1, LCase(temp), LCase(Me.ComboBox1.Text)) >= 1 Then matches.Add x, Split(temp, "|")
temp = ""
Next x

If matches.Count = 0 Then Exit Sub
ReDim matchedlist(1 To matches.Count, 0 To UBound(Cities, 2) - 1)
x = 0
For Each key In matches.keys
x = x + 1
For y = 0 To UBound(Cities, 2) - 1
matchedlist(x, y) = matches(key)(y)
Next y
Next key

With ComboBox1
.List = matchedlist
.DropDown
End With
End Sub


Private Sub ComboBox1_Click()
Application.EnableEvents = False
With ComboBox1
If .ListIndex = -1 Then GoTo continue
.Value = .List(.ListIndex, 6)
End With
continue:
Application.EnableEvents = True

End Sub

Reduction of code lines to speed up macro

$
0
0
How would I put the following onto a single line and have the code still work?

Range("AH2").Formula = "=IF(ISERROR(INDEX('[Daily MI Master Template.xlsm]MI'!$X$86:$X$13952,MATCH(A2,'[Daily MI Master Template.xlsm]MI'!$T$86:$T$13952,0))),"""",INDEX('[Daily MI Master Template.xlsm]MI'!$X$86:$X$13952,MATCH(A2,'[Daily MI Master Template.xlsm]MI'!$T$86:$T$13952,0)))"
Range("AF2:AF" & RowL).FillDown

Reduction of code lines to speed up macro

$
0
0
How would I put the following onto a single line and have the code still work?

Range("AH2").Formula = "=IF(ISERROR(INDEX('[Daily MI Master Template.xlsm]MI'!$X$86:$X$13952,MATCH(A2,'[Daily MI Master Template.xlsm]MI'!$T$86:$T$13952,0))),"""",INDEX('[Daily MI Master Template.xlsm]MI'!$X$86:$X$13952,MATCH(A2,'[Daily MI Master Template.xlsm]MI'!$T$86:$T$13952,0)))"
Range("AF2:AF" & RowL).FillDown

Issues with search and viewer

$
0
0
Hi people,

im trying to create a vba app in excel. ive managed to get few things done but now i get stuck.
link to the file: https://onedrive.live.com/?authkey=%...31F53D01FB8DCE


so if you open the file you will few sheets: startup, Full data list, intern data, access and comms and fdo checklist.
also some buttons. the populated listbox is just temorarely, this should be in seperate viewer which i will do later. there i want all necessary details like name, id, fdo start date, model machine, os and ssd for exmple. it would be great

i have have a viewer opening when i click on a name in the list a viewer will open met all details like the info above and with a print button that only print that viewer details

the second would be great that when i fill in details in the intern data input v1 and i press the add details button the filled in data is filled in on the full detail list (which works allready) but also want it filled in on the top of the FDO checklist like idsid, fdo date ssd s/n, customer name, wwdi and notes, notes should be linked to the data added in the extra or special request listbox in intern data input top listbox. then when i press add details and the fdo checklist is autofilled it needs to be saved or added per intern as sheet or fdo file in for example c:\interns.

if anyone can help me here that would be great. you have to download the file due the xlsm (macro) which doesnt work with google docs

thanks in advance

Use Data Validation List To Pull Info From Table

$
0
0
Hey everyone,

I'm trying to write a macro, I'm guessing using a For loop to pull data from a table full of information. The data will have a unique identifier of a location # (ie 101,102,103 etc). On a separate tab I am trying to use a drop down menu which allows the user to select a location and it will pull all the data from the list of data and copy it over to a select range.

- The data I'm pulling is on a tab called DATABASE and is located in columns A-D.
-I'm trying to copy it over to Survey tab in a range of A9:D200
-When it copies the data over it needs to stay in the same column.

No location will have exactly 200 but that is max at the moment for the data. The macro also needs to run after making a selection. If there is an easier way around this without VBA, I'm open to suggestions but I don't want to just manually copy and paste the info as this will eventually grow into a much larger database.

WorksheetFunction SumIfs With Multiple Criteria

$
0
0
Hi,

I am using the below formula within a macro to calculate the sum of everything with the code "120012". This formula works absolutely fine.

I'm trying to get the below to calculate the total when the criteria is "120010" + "820600". However i am unsure how to edit the below formula


Sheets("Journal").Range("K2").Value = WorksheetFunction.SumIf(Sheets("Journal").Range("C:C"), "=120010", _
Sheets("Journal").Range("D:D"))



Any help is much appreciated

Harry

VBA - Create 15 minute interval bases on start and enddate input

$
0
0
Goodday,

I'm strubbling with an issue to create 15 minute date interval in Excel. I have searched a lot on this form and googled a whole day but I didn't found something that could help me.

Problem description
A user will input a startdate (dd-mm-yyyy) in Cell B1 and a enddate (dd-mm-yyyy) in cell B2. When he or she clicks on a button, Excel should generate interval data bases on start and enddate.

Example

B1= 01-02-2016
B2= 29-02-2016


* Click on button *

Results in B4, B5, B6....
B4= 01-02-2016 00:15
B5= 01-02-2016 00:30
B6= 01-02-2016 00:45
....
B = 29-02-2016 23:45

See attachment Excel Example.

I'll hope there is someone smart who can help my with this problem.
Attached Files
Viewing all 50094 articles
Browse latest View live