want to know how to pick up whichever is less value from any two textboxes
↧
Regarding VBA userform
↧
Converting .txt to .xlsx
Hi, I have been using the code below to convert text to xlsx file and it has been working great. It converts all text files on the active directory and saves them as individual excel files. However, I wanted the macro to ask the user which files to convert and then select multiple files. I have tried with the GetOpenFilename, and it opens a dialogue box to select the text files but then it doesn't do the conversion anymore. Please help. I am really new at this. Thank you.
Sub ConvertTXTtoXLS()
Dim Dir_p As String, File_to_Open As String
Dir_p = ActiveWorkbook.Path
File_to_Open = Dir(Dir_p & "\")
While File_to_Open <> ""
If InStr(1, Right(File_to_Open, 3), "txt", vbTextCompare) <> 0 Then
Workbooks.OpenText Filename:=Dir_p & "\" & File_to_Open, _
Origin:=xlWindows, StartRow:=1, DataType:=xlFixedWidth, FieldInfo:=Array( _
Array(0, 1), Array(5, 1), Array(10, 1), Array(18, 1), Array(23, 1), Array(31, 1), Array(43, _
1), Array(48, 1), Array(53, 1), Array(84, 1), Array(107, 1), Array(130, 1), Array(153, 1), _
Array(176, 1), Array(199, 1), Array(222, 1), Array(245, 1), Array(268, 1), Array(291, 1), _
Array(296, 1), Array(301, 1), Array(306, 1), Array(314, 1), Array(324, 1)), _
TrailingMinusNumbers:=True
ActiveWorkbook.SaveAs Filename:=Dir_p & "\" & Left(File_to_Open, Len(File_to_Open) - 3) & "xlsx" _
, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
ActiveWorkbook.Close
End If
File_to_Open = Dir
Wend
Call MergeExcelFiles
End Sub
Sub ConvertTXTtoXLS()
Dim Dir_p As String, File_to_Open As String
Dir_p = ActiveWorkbook.Path
File_to_Open = Dir(Dir_p & "\")
While File_to_Open <> ""
If InStr(1, Right(File_to_Open, 3), "txt", vbTextCompare) <> 0 Then
Workbooks.OpenText Filename:=Dir_p & "\" & File_to_Open, _
Origin:=xlWindows, StartRow:=1, DataType:=xlFixedWidth, FieldInfo:=Array( _
Array(0, 1), Array(5, 1), Array(10, 1), Array(18, 1), Array(23, 1), Array(31, 1), Array(43, _
1), Array(48, 1), Array(53, 1), Array(84, 1), Array(107, 1), Array(130, 1), Array(153, 1), _
Array(176, 1), Array(199, 1), Array(222, 1), Array(245, 1), Array(268, 1), Array(291, 1), _
Array(296, 1), Array(301, 1), Array(306, 1), Array(314, 1), Array(324, 1)), _
TrailingMinusNumbers:=True
ActiveWorkbook.SaveAs Filename:=Dir_p & "\" & Left(File_to_Open, Len(File_to_Open) - 3) & "xlsx" _
, FileFormat:=xlOpenXMLWorkbook, CreateBackup:=False
ActiveWorkbook.Close
End If
File_to_Open = Dir
Wend
Call MergeExcelFiles
End Sub
↧
↧
Create Reports Based on Unique IDs - Condition to match each row to number
Good afternoon,
I have a macro that takes data from a "master" tab and creates separate reports based on unique names from column A, AND Formatting based on the Template. When I run the "Usage Report" macro (press button on "CMD" tab), I am able to get the reports on separate tabs, and in the correct template format, without compromising any of the formulas built into the template - which is great!
My next goal is to try and dump the data in numerical order - matching the stage number from the Master file (column C) to each generated report, (column C).
Example:
from the Master Tab, I have two different Names in column A ("Test 1" and "Test 2"), each name has stages assigned in column C
The Template has stages listed (ie. "Under, Prefill, 1, 2, 3, 4, 5, 6.......") - listed in column C
When I run the Usage Report Macro, I should get two separate reports (one for the "Test 1" and one for the "Test 2").
Is there a way to ensure that when the macro runs, the data also automatically populate in numerical order AND matches the number from the template (column C)
I attached an example of how I would like for the reports to look when the macro is run.
For "Test 1" - No stages were skipped in the master (I have stages Prefill - 13)
For "Test 2" - Several stages were skipped in the master, so I would like for the report to show where those "skipped stages" are.
I have a macro that takes data from a "master" tab and creates separate reports based on unique names from column A, AND Formatting based on the Template. When I run the "Usage Report" macro (press button on "CMD" tab), I am able to get the reports on separate tabs, and in the correct template format, without compromising any of the formulas built into the template - which is great!
My next goal is to try and dump the data in numerical order - matching the stage number from the Master file (column C) to each generated report, (column C).
Example:
from the Master Tab, I have two different Names in column A ("Test 1" and "Test 2"), each name has stages assigned in column C
The Template has stages listed (ie. "Under, Prefill, 1, 2, 3, 4, 5, 6.......") - listed in column C
When I run the Usage Report Macro, I should get two separate reports (one for the "Test 1" and one for the "Test 2").
Is there a way to ensure that when the macro runs, the data also automatically populate in numerical order AND matches the number from the template (column C)
I attached an example of how I would like for the reports to look when the macro is run.
For "Test 1" - No stages were skipped in the master (I have stages Prefill - 13)
For "Test 2" - Several stages were skipped in the master, so I would like for the report to show where those "skipped stages" are.
HTML Code:
Sub RunReport()
Sheets.Add.Name = "SplitCode"
'Select and copy
Worksheets("Master").Activate
'Copy Range Info A1
Range("A1", Range("A2").End(xlDown)).Copy Worksheets("SplitCode").Range("A1")
'Delete dupicates
Worksheets("SplitCode").Activate
Range("A1", Range("A2").End(xlDown)).RemoveDuplicates Columns:=Array(1)
'Create Usage Reports with Unique Names
Dim a, i As Long, e, dic As Object
Set dic = CreateObject("Scripting.Dictionary")
With Sheets("Master").Cells(1).CurrentRegion
.Parent.AutoFilterMode = False
a = .Columns(1).Value
For i = 2 To UBound(a, 1) - 1
If Not dic.exists(a(i, 1)) Then
dic(a(i, 1)) = Empty
If Not Evaluate("isref('" & a(i, 1) & "'!A1)") Then
Sheets("Template").Copy , Sheets(Sheets.Count)
Sheets(Sheets.Count).Name = a(i, 1)
End If
On Error Resume Next
With Sheets(a(i, 1)).[a18].CurrentRegion
.SpecialCells(2, 1).ClearContents
.Offset(1).Columns(1).ClearContents
End With
On Error GoTo 0
.AutoFilter 1, a(i, 1)
'Report Template 1
With .Offset(1).Resize(.Rows.Count - 1)
For Each e In Array(Array("B:C", "B20"), Array("D:E", "E20"), _
Array("F:J", "J20"), Array("G:I", "K20"), Array("J", "N20"), Array("K:N", "P20"))
.Columns(e(0)).Copy Sheets(a(i, 1)).Range(e(1))
Next
End With
End If
Next
End With
End Sub
↧
Find all instances (multiple) of a list of values and return the column and row number
I currently have a list of values that are randomly populating a table with numbered rows and column headings. I would then like to be able to search this randomly populated table and pull a list of all the column/row identifiers separated by commas where the value can be found for each value within the original list. I would also like to be able to have the option of making the original list longer by leaving blank cells at the bottom that can be filled in to be randomly populated and then have their column/row identifiers pulled, however if the cells are blank in the original list then to just ignore them.
Attached are a screenshot of the spreadsheet and the original spreadsheet. Thank you!
Attached are a screenshot of the spreadsheet and the original spreadsheet. Thank you!
↧
Trying to find last row.
Hey everyone,
Trying to find last row when I have an indirect function in my range. I have it set up that if the indirect function finds something it displays it and if not then displays blank
. The problem is when I run my VBA to find last row(used to make dynamic selection for printing) it goes to the end of the table because of the formula inside the cell. Any help would be awesome!.
Trying to find last row when I have an indirect function in my range. I have it set up that if the indirect function finds something it displays it and if not then displays blank
Code:
=IF(NOT(ISBLANK(INDIRECT("'Priority 1'!A50"))),INDIRECT("'Priority 1'!A50"),"")
Code:
Sub dynRp1()
'Declare Variables
Dim startCell As Range, lastRow As Long, ws As Worksheet
'Set objects
Set ws = Sheet1
Set startCell = Range("B2")
'Find last row and column of data
lastRow = ws.Cells(ws.Rows.Count, startCell.Column).End(xlUp).Row
'Select dynamic range of data
ws.Range(startCell, ws.Cells(lastRow, "G")).Select
End Sub
↧
↧
Listbox causes Compile Error: Method or Data member not found
I have a workbook with 4 listbox's on sheet1
When opening the workbook I receive the error message: Compile Error: Method or Data Member not found.
When clicking an item in Listbox1 it populates Listbox2, and so on.
I suspect it has something to do with Listbox2 not being populated upon opening of the workbook. Below is a snippet of the code causing the break
Private Sub ListBox1_Click()
Sheet1.ListBox2.Clear
Sheet1.ListBox3.Clear
Sheet1.ListBox4.Clear
Dim Path As Range
Dim fso As Object
Dim fsoRoot As Object
Dim fsoFolder As Object
Dim hostFolder As String, Zdir As String
Any suggestions or ideas is certainly appreciated.
Thanks in advance.
William
When opening the workbook I receive the error message: Compile Error: Method or Data Member not found.
When clicking an item in Listbox1 it populates Listbox2, and so on.
I suspect it has something to do with Listbox2 not being populated upon opening of the workbook. Below is a snippet of the code causing the break
Private Sub ListBox1_Click()
Sheet1.ListBox2.Clear
Sheet1.ListBox3.Clear
Sheet1.ListBox4.Clear
Dim Path As Range
Dim fso As Object
Dim fsoRoot As Object
Dim fsoFolder As Object
Dim hostFolder As String, Zdir As String
Any suggestions or ideas is certainly appreciated.
Thanks in advance.
William
↧
Setting row number as a variable based on MATCH criteria
I'm trying to write a code that will look at the "Week of" date on the INTERNAL sheet (named "ScoreWk") and use it to find the corresponding row number on the Progress Chart sheet ("WeekOf"), then index match the values from O ("FacilAcc") to the reference in C ("ZONE").
I want to tie this to the button control on the INTERNAL sheet. (Bonus points if it will also automatically save the INTERNAL sheet as a pdf.)
I can't figure out how to set my r variable correctly and keep getting errors.
I either get a 1004, "Unable to get the Match property of the WorksheetFunction class" in the current configuration, or if I set R as a range and use that code I get an error 13 "Type mismatch."
I want to tie this to the button control on the INTERNAL sheet. (Bonus points if it will also automatically save the INTERNAL sheet as a pdf.)
I can't figure out how to set my r variable correctly and keep getting errors.
Code:
Sub UPDATE()
Dim k As Integer
Dim r As Integer ' Range
' Sets r as the row number of the corresponding date
' Set r = Range("WeekOf").Find(what:=Range("ScoreWk").Value, LookIn:=xlValues, lookat:=xlWhole)
r = Application.WorksheetFunction.Match("ScoreWk", "WeekOf")
For k = 3 To 11
Cells(r, k).Value = WorksheetFunction.Index(Range("FacilAcc"), WorksheetFunction.Match(Cells(1, k).Value, Range("ZONE"), 0))
Next k
End Sub
↧
Helper Columns to identify Split Payments
Hello Everyone
I have a payment data(70K rows) where some of the amounts paid have been split and I'm looking to use an excel formula or vba macro to identify the split shapes. When a split payment occurs the orignal amount is automatically cancelled by the system and the splits shapes assume a status of paid. A split shape could further be split. The transReference is the same for both cancelled origanal payment and the split shapes, so effectively the 'TransReference field does not contain unique values(duplicates).
I want to add an extra two columns ;1) IsSplit - to indicate if a transaction is spit; 2) Remarks - to indicate if a transaction is a shape of a split payment as I've highlighted in the attachment. I'm happy to explain further as I can imagine its a bit complex, I struggled to give it a title! As always I appreciate your help very much. Thanks
I have a payment data(70K rows) where some of the amounts paid have been split and I'm looking to use an excel formula or vba macro to identify the split shapes. When a split payment occurs the orignal amount is automatically cancelled by the system and the splits shapes assume a status of paid. A split shape could further be split. The transReference is the same for both cancelled origanal payment and the split shapes, so effectively the 'TransReference field does not contain unique values(duplicates).
I want to add an extra two columns ;1) IsSplit - to indicate if a transaction is spit; 2) Remarks - to indicate if a transaction is a shape of a split payment as I've highlighted in the attachment. I'm happy to explain further as I can imagine its a bit complex, I struggled to give it a title! As always I appreciate your help very much. Thanks
↧
[SOLVED] Formula to confirm cell entries match existing table depending on user chosen on drop down
hello
I am trying to create a table were a lookup function is used.
If a certain user is picked from timelog column B, the the matching nickname is picked from source column A and the nickname is displayed in timelog column M in the matching row
right now I have the code =VLOOKUP((B3), '[SAFELOG P1W5.xlsm]Source'!$A$3:$B$40, 1, FALSE) but it is returning N/A error?
How can it be set up that if a person picks their name and they enter their tips and service charge in "time log" tab a formula can check if the amounts entered for that user matches those in tab "Tips" for that user
for example Shara, when she picks her name enters her time and tips for the formula to cells (in time log tab) J3 and I3 green (and red if they do not match) if the amounts entered match the values in Tips tab for that user in this case £12.50 and £13.50
I am guessing a look up formula of some type can also achieve this
I am trying to create a table were a lookup function is used.
If a certain user is picked from timelog column B, the the matching nickname is picked from source column A and the nickname is displayed in timelog column M in the matching row
right now I have the code =VLOOKUP((B3), '[SAFELOG P1W5.xlsm]Source'!$A$3:$B$40, 1, FALSE) but it is returning N/A error?
How can it be set up that if a person picks their name and they enter their tips and service charge in "time log" tab a formula can check if the amounts entered for that user matches those in tab "Tips" for that user
for example Shara, when she picks her name enters her time and tips for the formula to cells (in time log tab) J3 and I3 green (and red if they do not match) if the amounts entered match the values in Tips tab for that user in this case £12.50 and £13.50
I am guessing a look up formula of some type can also achieve this
↧
↧
Reformatting a row of cells into a block of cells
Hi,
I guess I dont know what words to search in the forum, but I'm sure this has been asked: How do I make a 16-by-1 (columns-by-rows) set of data into a 4-by-4 set, or an 8-by-2 set....or a 2-by-8 set for that matter? Or as in the picture, how do I turn the red into blue without retyping it like I did here (a 7-by-1 into a 4-by-2 with a space left over):
Capture.PNG
I'm taking comma-delimited data from a source in one long string, like "1000, 1005, 1006, 1010, A1012, B0001, B0030, ...". So all that goes into cell A1. I can text-to-columns successfully and end up with a single-row of cells A1=1000, B1=1005, etc... But I'm not keen to scrolling way over to the right to see the end of my result, which could be hundreds of cells. I'd rather see the finished product as a block of data on my screen - no scrolling.
Let's say I have 200 cells in a single row. I'd rather see my 200 cells in a convenient 10x20 block, say columns A-J (10 columns) and rows 1-20 = 200 cells. Transpose? Not exactly. Copy-paste-copy-paste-copy-paste...? Yeah - did that, no.
I guess I'm looking for a smart-transpose, and perhaps there's an excel function already built for just that.
Any help would be appreciated.
Thank you.
I guess I dont know what words to search in the forum, but I'm sure this has been asked: How do I make a 16-by-1 (columns-by-rows) set of data into a 4-by-4 set, or an 8-by-2 set....or a 2-by-8 set for that matter? Or as in the picture, how do I turn the red into blue without retyping it like I did here (a 7-by-1 into a 4-by-2 with a space left over):
Capture.PNG
I'm taking comma-delimited data from a source in one long string, like "1000, 1005, 1006, 1010, A1012, B0001, B0030, ...". So all that goes into cell A1. I can text-to-columns successfully and end up with a single-row of cells A1=1000, B1=1005, etc... But I'm not keen to scrolling way over to the right to see the end of my result, which could be hundreds of cells. I'd rather see the finished product as a block of data on my screen - no scrolling.
Let's say I have 200 cells in a single row. I'd rather see my 200 cells in a convenient 10x20 block, say columns A-J (10 columns) and rows 1-20 = 200 cells. Transpose? Not exactly. Copy-paste-copy-paste-copy-paste...? Yeah - did that, no.
I guess I'm looking for a smart-transpose, and perhaps there's an excel function already built for just that.
Any help would be appreciated.
Thank you.
↧
Previously working Macro-enabled file now throwing "Class not registered"
Hello -
I have a large Excel file with a bit of code that I found on the web and copied because it accomplished exactly what I needed. It worked fine for months.. I subsequently had a laptop issue and had to reset my Windows installation, which also required me to re-download Office 365 from the MS website and install it again. Now the Excel file throws this error upon file save: "Run-time error '-2147221164 (80040154)':" and "Class not registered".
When I click Debug in the pop-up window, it appears to be choking on this line of code:
Set GetJavaScriptControlObject = CreateObject("MSScriptControl.ScriptControl")
I tried implementing some suggestions I found on a Google search but kind of hit a dead end. A lot of this is Greek to me. Can anyone help identify a cause / fix for this?
Much appreciated!
jbayko
I have a large Excel file with a bit of code that I found on the web and copied because it accomplished exactly what I needed. It worked fine for months.. I subsequently had a laptop issue and had to reset my Windows installation, which also required me to re-download Office 365 from the MS website and install it again. Now the Excel file throws this error upon file save: "Run-time error '-2147221164 (80040154)':" and "Class not registered".
When I click Debug in the pop-up window, it appears to be choking on this line of code:
Set GetJavaScriptControlObject = CreateObject("MSScriptControl.ScriptControl")
I tried implementing some suggestions I found on a Google search but kind of hit a dead end. A lot of this is Greek to me. Can anyone help identify a cause / fix for this?
Much appreciated!
jbayko
↧
Capturing user name and timestamp
Hi All,
I have attached an excel sheet, which already has some macros and multiple people makes the entries to it. I would like to capture the name of the person who makes editing with a time stamp in second sheet (COMPLETE LIST). For capturing the name, I want an input box to be appeared when you open the excel sheet.
Can someone please help me with the coding, as I don't have idea.
Thanks in advance.
Jefy
I have attached an excel sheet, which already has some macros and multiple people makes the entries to it. I would like to capture the name of the person who makes editing with a time stamp in second sheet (COMPLETE LIST). For capturing the name, I want an input box to be appeared when you open the excel sheet.
Can someone please help me with the coding, as I don't have idea.
Thanks in advance.
Jefy
↧
[SOLVED] Listing All Dates in a date range(s) into another worksheet with VBA
Hello all,
In one worksheet, named 'Data', I have a range of dates.
VBA Question 1.PNG
I want to cycle through the dates, giving a break down for each day into a seperate worksheet named 'List_All', like below.
VBA Question 2.PNG
Currently, my VBA code is using two loops seems to be duplicating certain dates, so I'm probably making the loop(s) more complicated than they need to be, or I'm missing some basic logic?
VBA Question 3.PNG
My code is:
In one worksheet, named 'Data', I have a range of dates.
VBA Question 1.PNG
I want to cycle through the dates, giving a break down for each day into a seperate worksheet named 'List_All', like below.
VBA Question 2.PNG
Currently, my VBA code is using two loops seems to be duplicating certain dates, so I'm probably making the loop(s) more complicated than they need to be, or I'm missing some basic logic?
VBA Question 3.PNG
My code is:
Code:
Public Sub List_Dates()
Dim wsData, wsList_All As Worksheet
Dim lDataCount, lDateFill, i, j, k As Long
Dim dStartDate, dEndDate As Date
Set wsData = ThisWorkbook.Sheets("Data")
Set wsList_All = ThisWorkbook.Sheets("List_All")
lDataCount = Application.WorksheetFunction.CountA(wsData.Range("A:A"))
k = 3
With wsData
'Loops through data on Data
For i = 2 To lDataCount
dStartDate = .Cells(i, 2)
dEndDate = .Cells(i, 3)
lDateFill = DateDiff("d", dStartDate, dEndDate) + 1
'Fills out entire date ranges in List_All
For j = k To lDateFill + k
wsList_All.Cells(j, 1).Value = .Cells(i, 1).Value
wsList_All.Cells(j, 2).Value = dStartDate
Range(wsList_All.Cells(j, 3), wsList_All.Cells(j, 4)).Value = .Range(.Cells(i, 4), .Cells(i, 5)).Value
dStartDate = dStartDate + 1
k = k + 1
Next j
Next i
End With
End Sub
↧
↧
Dialogue Box for Attachment
Hi gurus,
how can i get dialogue box in VBA for attachments before sending email ?
I'm currently using the following code and it creates PDF file which is fine but I also want some other files to attach with the email, however I'd like it to select it manually rather than defining the path. Please can someone guide me on this.
Many thanks,
how can i get dialogue box in VBA for attachments before sending email ?
I'm currently using the following code and it creates PDF file which is fine but I also want some other files to attach with the email, however I'd like it to select it manually rather than defining the path. Please can someone guide me on this.
Many thanks,
Code:
Private Sub CommandButton1_Click()
Dim IsCreated As Boolean
Dim i As Long
Dim PdfFile As String, Title As String
Dim OutlApp As Object
' Define PDF filename
PdfFile = ActiveWorkbook.FullName
i = InStrRev(PdfFile, ".")
If i > 1 Then PdfFile = Left(PdfFile, i - 1)
PdfFile = PdfFile & "_" & ActiveSheet.Name & ".pdf"
' Export activesheet as PDF
With ActiveSheet
.ExportAsFixedFormat Type:=xlTypePDF, Filename:=PdfFile, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
End With
' Use already open Outlook if possible
On Error Resume Next
Set OutlApp = GetObject("Outlook.Application")
If Err Then
Set OutlApp = CreateObject("Outlook.Application")
IsCreated = True
End If
OutlApp.Visible = True
On Error GoTo 0
' Prepare e-mail with PDF attachment
With OutlApp.CreateItem(0)
CarryOn = MsgBox("ARE YOU SURE?", vbYesNo, "TEST")
If CarryOn = vbYes Then
' Prepare e-mail
.Subject = "XYZ"
.To = "XYZ@XYZ.COM"
.Body = "Hi," & vbLf & vbLf _
& "XYZ." & vbLf & vbLf _
& "XYZ," & vbLf _
& Application.UserName & vbLf & vbLf
.Attachments.Add PdfFile
' Try to send
On Error Resume Next
.send
Application.Visible = True
If Err Then
MsgBox "E-mail was not sent", vbExclamation
Else
MsgBox "E-mail successfully sent", vbInformation
End If
On Error GoTo 0
End If
End With
' Delete PDF file
Kill PdfFile
' Release the memory of object variable
Set OutlApp = Nothing
End Sub
↧
[SOLVED] VBA Copy & Paste - Method Range of Object worksheet failed.
Hello all,
I'm running an Advanced Filter and I am getting a run time error 1004 - method range of object worksheet failed ERROR on this line of code:
I want to Concatenate L_Name & F_Name ( i.e. Marley, Bob :cool:) in a another column to use in a dropdown list.
Thank you in advance for your assistance.
V/r,
Jim
I'm running an Advanced Filter and I am getting a run time error 1004 - method range of object worksheet failed ERROR on this line of code:
Code:
.Range("AN4" & LastFiltRow).Value = .Range("AH4 & LastFiltRow").Value & ", " & .Range("AG4 & LastFiltRow").Value 'Copy Full Names
Code:
Sub CREW_ADVFilter_ISO_Crew_Load()
Dim LastCrewRow As Long
Dim LastFiltRow As Long
With Sheet2
'StopCalc
'Create Crew_Load List on CREW_INFO_DB Using Advanced Filter & Sort
.Range("AC4:AL99999").ClearContents 'Clear any Previous Results
LastCrewRow = Sheet2.Range("A99999").End(xlUp).Row
'DeleteFilters
Sheet2.Range("A3:J" & LastCrewRow).AdvancedFilter xlFilterCopy, CriteriaRange:=Sheet2.Range("AA3:AA4"), CopyToRange:=Sheet2.Range("AC3:AL3"), Unique:=True
LastFiltRow = Sheet2.Range("AC99999").End(xlUp).Row
If LastFiltRow < 4 Then GoTo NoEvent
'Sort Names From A To Z
Sheet2.Sort.SortFields.Clear
Sheet2.Sort.SortFields.Add Key:=.Range("AH4"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
With Sheet2.Sort
.SetRange Range("AC5:AL" & LastCrewRow)
.Apply
End With
.Range("AN4" & LastFiltRow).Value = .Range("AH4 & LastFiltRow").Value & ", " & .Range("AG4 & LastFiltRow").Value 'Copy Full Names
Application.CutCopyMode = xlCopy
NoEvent:
'ResetCalc
End With
End Sub
V/r,
Jim
↧
Multiplying large numbers
I am trying to perform exponential calculations on large numbers (in the quadrillion range), but I get error messages. Is there a way to do this? Maybe an add-in? My internet searching is failing me. I have Excel 365 running on an i7, 8th gen laptop with 16 Gb RAM.
↧
Excel app won't accept 2020 dates on one tab, but will on other tabs
EDIT: I just attached a screenshot of the date-error message I get; probably won't help with debugging, but you can see it supposedly allows 2020 dates, but errors out on them.
Hi all,
Just joined the forum, hoping to get a nudge in the right debugging direction to fix a problem I can't solve on my own. My knowledge of VB and Excel macros is beginner-level at best, but I'm usually pretty good at figuring out existing code for languages I don't know. This time, I'm stumped.
I'm running an early-2000s Excel application to manage multiple stock-trading accounts; the app hasn't been updated in years and the author seems to have gone dark, but the app itself still functions running on Excel 2007 and is essential to my daily trade-management activities.
The problem is that one module will not accept date entries for 2020, but other portions of that same module will accept them, as well as other worksheets in the application. Everything worked fine through the end of 2019 and the problem didn't reveal itself until I tried entering a trading expense for January into the app. It looks to me that some sort of date-validation code has barfed once the current year hit 2020.
I have opened the sheets in Visual Basic developer mode and done searches for date ranges, "2019", "2020", "20" and everything else I could think of, looking for a date-range test and just can't find anything, but I'm sure this is due to lack of knowledge of Excel programming. I would greatly appreciate some guidance into what needs patching to eliminate this bug.
I (hopefully) have attached a Zip file with two worksheets and a Read Me First file to walk you through the problem. Note that I believe these should be placed into C:\Excel debug\ to execute properly and may need an Excel 2007 environment to run properly.
Many, many thanks to anybody who might be able to help me out.
Best Regards,
Jim
Hi all,
Just joined the forum, hoping to get a nudge in the right debugging direction to fix a problem I can't solve on my own. My knowledge of VB and Excel macros is beginner-level at best, but I'm usually pretty good at figuring out existing code for languages I don't know. This time, I'm stumped.
I'm running an early-2000s Excel application to manage multiple stock-trading accounts; the app hasn't been updated in years and the author seems to have gone dark, but the app itself still functions running on Excel 2007 and is essential to my daily trade-management activities.
The problem is that one module will not accept date entries for 2020, but other portions of that same module will accept them, as well as other worksheets in the application. Everything worked fine through the end of 2019 and the problem didn't reveal itself until I tried entering a trading expense for January into the app. It looks to me that some sort of date-validation code has barfed once the current year hit 2020.
I have opened the sheets in Visual Basic developer mode and done searches for date ranges, "2019", "2020", "20" and everything else I could think of, looking for a date-range test and just can't find anything, but I'm sure this is due to lack of knowledge of Excel programming. I would greatly appreciate some guidance into what needs patching to eliminate this bug.
I (hopefully) have attached a Zip file with two worksheets and a Read Me First file to walk you through the problem. Note that I believe these should be placed into C:\Excel debug\ to execute properly and may need an Excel 2007 environment to run properly.
Many, many thanks to anybody who might be able to help me out.
Best Regards,
Jim
↧
↧
Copy data based on criteria in column
Hello Gurus!
I have set of data in initial table, which consists of 6 columns. Please help to create macro, which will copy all data, but taking into account pre-defined value (="Criteria") in Column 2. Format of both tables always the same. I will be appreciated for any help.
P.S please avoid auto filter solution - it is not my case :)
I have set of data in initial table, which consists of 6 columns. Please help to create macro, which will copy all data, but taking into account pre-defined value (="Criteria") in Column 2. Format of both tables always the same. I will be appreciated for any help.
P.S please avoid auto filter solution - it is not my case :)
↧
Trying to auto sort and set the print area for a report
Hello everyone!
So I have a new task and I'm sure there is a way to automate it some. So at the end of each week I need to make a report that sorts based on the salesperson and date. So I would like a macro that would seperate each of column F into groups and then seperates It by date (ascending). Can anyone help me accomplish this? Or how do I do this? While I am sure there is a way based on filters and copying and pasting, it seems like a macro would make it go a lot quicker. At the end of the macro it should set the print area to the sorted lists. I included a before and after that should demonstrate what I am trying to accomplish.
Any help is appreciated. Thanks!
So I have a new task and I'm sure there is a way to automate it some. So at the end of each week I need to make a report that sorts based on the salesperson and date. So I would like a macro that would seperate each of column F into groups and then seperates It by date (ascending). Can anyone help me accomplish this? Or how do I do this? While I am sure there is a way based on filters and copying and pasting, it seems like a macro would make it go a lot quicker. At the end of the macro it should set the print area to the sorted lists. I included a before and after that should demonstrate what I am trying to accomplish.
Any help is appreciated. Thanks!
↧
Parse text in cell in last row
I'm trying to change the text contents of the col A cell of the last row of the active worksheet. I can get the row with this code although I suspect there's a simpler way? But how do I then proceed to work on the contents of it please?
Code:
Sub FirstEmptyRowA1_nr()
Dim nr As Integer
Dim ws As Worksheet
Set ws = Sheets("Target")
With ws
'Find first empty row
nr = .Cells(.Rows.Count, "C").End(xlUp).Row + 1
'MsgBox nr
End With
End Sub
↧