excel-vba

How do I sign an XLA from Excel 2016 with a timestamp?

无人久伴 提交于 2020-05-15 04:49:06
问题 I am struggling to sign an XLA from Excel 2016 with a timestamp . This is important, because without a timestamp the signature becomes invalid when the code signing certificate used expires. Unfortunately by default Excel does not apply a timestamp to the signature. Microsoft's documentation (https://docs.microsoft.com/en-us/deployoffice/security/use-digital-signatures-with-office) states: To use the time stamp functionality with digital signatures, you must complete the following tasks: Set

VBA - convert to date

孤街浪徒 提交于 2020-05-14 14:57:07
问题 I have one more time a problem: I want to convert from Strings to dates in VBA The Strings look like: YYYY-DD-MM The date should be like: DD.MM.YYYY I know, normally you do this with the method cdate(), but it doesn't work here. I think it's because the structure of the string is bad to convert. thanks for your help InformatikBabo 回答1: Sub Main() Dim strDate As String strDate = "2013-06-11" Debug.Print "Original Date: ", strDate Debug.Print "CDate() Conversion: ", CDate(strDate) Debug.Print

VBA code to find the sum of unique elements in a range

杀马特。学长 韩版系。学妹 提交于 2020-05-14 13:39:25
问题 I have 2 columns and need a VBA code to sum the values of unique elements in column "A", print the unique elements in column "D" and sum in column "E" :- Name Value Name Sum A 1 A 13 A 2 B 7 B 1 C 3 B 3 C 2 A 1 B 2 A 3 B 1 A 2 A 4 C 1 Can anyone help on this, this is what I tried :- Sub CountSum() Dim c As Collection, wf As WorksheetFunction, _ K As Long, N As Long, i As Long, _ v As Variant, d As Collection, y As Variant Set c = New Collection Set d = New Collection Set wf = Application

Sending Email with PNG image in Outlook Body using VBA

早过忘川 提交于 2020-05-14 12:39:11
问题 After doing a thorough research in the internet, I was able to build the following codes: Sub EmailSuccess() Dim OutlookApplication As Outlook.Application Dim OutlookMailItem As Outlook.MailItem Dim Recipients As Object Dim myRecipients As Outlook.Recipient Dim sTo As Object Dim CCs As Object Dim myCCs As Outlook.Recipient Dim sCc As Object Dim emailContent As String Dim OutDocSto As String Dim ArchiveLinks As String Dim KendoxDocs As String Dim LinksGE As String Dim PicSheet2 As Object Dim

Insert Specific Number of Rows

我的未来我决定 提交于 2020-05-13 18:19:09
问题 I'm trying to insert a specific number of rows. Right now I'm using the below code to insert 4 lines. I'm trying to write a line of code that will insert a certain number or rows based on a number in a certain cell. For example, if I wanted to insert 4 rows and cell A2 is the cell where I can change the number of rows I want to add, what code would I use to add any number of rows based off what number I insert in cell A2. ActiveCell.EntireRow.Select Selection.Insert Shift:=xlDown Selection

Insert Specific Number of Rows

穿精又带淫゛_ 提交于 2020-05-13 18:18:43
问题 I'm trying to insert a specific number of rows. Right now I'm using the below code to insert 4 lines. I'm trying to write a line of code that will insert a certain number or rows based on a number in a certain cell. For example, if I wanted to insert 4 rows and cell A2 is the cell where I can change the number of rows I want to add, what code would I use to add any number of rows based off what number I insert in cell A2. ActiveCell.EntireRow.Select Selection.Insert Shift:=xlDown Selection

loop in GAMS for scenario generation in excel

十年热恋 提交于 2020-05-13 07:50:47
问题 I have an optimization model and I try to solve this model for different input files which I exactly call as "solve the model under different scenarios". For that reason, I need a loop to read the data from excel for each different sheet. Let me make myself clear: For example, in the image below we have a data with 4 scenarios and the sheet names are increasing one by one for each scenario This data has to be read as a table for each scenario, like in the excel file. I try to read the data

Use of .NumberFormat to Format Decimal Places in Excel VBA

一曲冷凌霜 提交于 2020-05-13 02:48:56
问题 I am inserting data into a Word doc from an Excel spreadsheet. There is a value that has more than 2 decimal places. I am using the following code to try to convert it to 2 decimal places and paste it to my doc. wdApp.Selection.GoTo what:=-1, Name:="Device_Avail" ''Referring to the total count column in the Device Availability worksheet. Set devAvailRow = shDevAvail.Range("A:A").Find("Overall Totals:", After:=Cells(1, 1), searchdirection:=xlPrevious) ''Actual piece to format value to 2

Use of .NumberFormat to Format Decimal Places in Excel VBA

扶醉桌前 提交于 2020-05-13 02:44:07
问题 I am inserting data into a Word doc from an Excel spreadsheet. There is a value that has more than 2 decimal places. I am using the following code to try to convert it to 2 decimal places and paste it to my doc. wdApp.Selection.GoTo what:=-1, Name:="Device_Avail" ''Referring to the total count column in the Device Availability worksheet. Set devAvailRow = shDevAvail.Range("A:A").Find("Overall Totals:", After:=Cells(1, 1), searchdirection:=xlPrevious) ''Actual piece to format value to 2

Use of .NumberFormat to Format Decimal Places in Excel VBA

谁说我不能喝 提交于 2020-05-13 02:42:20
问题 I am inserting data into a Word doc from an Excel spreadsheet. There is a value that has more than 2 decimal places. I am using the following code to try to convert it to 2 decimal places and paste it to my doc. wdApp.Selection.GoTo what:=-1, Name:="Device_Avail" ''Referring to the total count column in the Device Availability worksheet. Set devAvailRow = shDevAvail.Range("A:A").Find("Overall Totals:", After:=Cells(1, 1), searchdirection:=xlPrevious) ''Actual piece to format value to 2