excel-vba

Converting String to Hex in Excel VBA

霸气de小男生 提交于 2020-01-29 07:54:51
问题 I need to convert strings to hexadecimals in my Excel VBA macro. I tried: Dim val As String val = "10" Dim hexVal As Integer hexVal = Convert.ToInt32(val, 16) but Convert.ToInt32(val, 16) does not work, I'm guessing because it's not VB.NET? Anyway, I can use CInt(val) to convert a string to an integer but if I have the string representation of a hex value, e.g. "3366CC", how do I convert it to hex so that I can perform hex calculations on it? 回答1: In VBA you need to mess about with the &H

Converting String to Hex in Excel VBA

自闭症网瘾萝莉.ら 提交于 2020-01-29 07:54:26
问题 I need to convert strings to hexadecimals in my Excel VBA macro. I tried: Dim val As String val = "10" Dim hexVal As Integer hexVal = Convert.ToInt32(val, 16) but Convert.ToInt32(val, 16) does not work, I'm guessing because it's not VB.NET? Anyway, I can use CInt(val) to convert a string to an integer but if I have the string representation of a hex value, e.g. "3366CC", how do I convert it to hex so that I can perform hex calculations on it? 回答1: In VBA you need to mess about with the &H

Post JSON to web in excel vba

一曲冷凌霜 提交于 2020-01-29 06:34:47
问题 I want to POST some JSON with some VBA: Dim sURL As String, sHTML As String, sAllPosts As String Dim oHttp As Object Dim blWSExists As Boolean Set oHttp = CreateObject("MSXML2.XMLHTTP") sURL = "some webste.com" oHttp.Open "POST", sURL, False oHttp.setRequestHeader "Content-type", "application/json" oHttp.setRequestHeader "Accept", "application/json" oHttp.Send (mType = OPEN_SYSTEM_TRADE & systemOwnerId = 10) sHTML = oHttp.ResponseText Worksheets("Open1").Range("A1").Value = sHTML The

Using Indirect function in Data Validation through VBA

前提是你 提交于 2020-01-28 11:37:06
问题 I am using the indirect function in my excel sheet through VBA , I am getting an error when I try to substitute the cell address in. =indirect(F5) I am not able to substiture the "F5" with a variable here is my code. With Selection.Validation .Delete .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _ xlBetween, Formula1:="=indirect(F5)" .IgnoreBlank = True .InCellDropdown = True .InputTitle = "" .ErrorTitle = "" .InputMessage = "" .ErrorMessage = "" .ShowInput = True

Using Indirect function in Data Validation through VBA

回眸只為那壹抹淺笑 提交于 2020-01-28 11:36:05
问题 I am using the indirect function in my excel sheet through VBA , I am getting an error when I try to substitute the cell address in. =indirect(F5) I am not able to substiture the "F5" with a variable here is my code. With Selection.Validation .Delete .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:= _ xlBetween, Formula1:="=indirect(F5)" .IgnoreBlank = True .InCellDropdown = True .InputTitle = "" .ErrorTitle = "" .InputMessage = "" .ErrorMessage = "" .ShowInput = True

excel vba not exporting pagesetup to pdf correctly

可紊 提交于 2020-01-28 02:18:56
问题 I have code which formats a worksheet to the desired setup and layout (one page wide and tall in landscape). When I run the code (part of a long macro) it formats the pagesetup correctly. If I manually export and save it as a pdf, then it uses the correct page setup, producing a one page PDF that is in landscape. However, the same export done by VBA produces a PDF that is severalpages long and in portrait. i can't figure out why it's doing this. i've tried various solutions such as selecting

VBA to Enter Data Online and Submit Form

馋奶兔 提交于 2020-01-27 08:16:44
问题 I'm trying to use VBA to submit data from Excel to a webform online. The issue happens within the * area where I'm trying to select and update the form. I've tried a variety of options (getelement by ID, name, etc.) without any success. I believe the issue has to do with identifying the appropriate element. I've seen advice about using the Locals feature in VBA, but I'm not sure how to use that for this purpose. I have a feeling someone with some experience could figure this out very quickly

VBA to Enter Data Online and Submit Form

…衆ロ難τιáo~ 提交于 2020-01-27 08:15:38
问题 I'm trying to use VBA to submit data from Excel to a webform online. The issue happens within the * area where I'm trying to select and update the form. I've tried a variety of options (getelement by ID, name, etc.) without any success. I believe the issue has to do with identifying the appropriate element. I've seen advice about using the Locals feature in VBA, but I'm not sure how to use that for this purpose. I have a feeling someone with some experience could figure this out very quickly

Excel Date Conversion from yyyymmdd to mm/dd/yyyy

≡放荡痞女 提交于 2020-01-26 23:55:09
问题 I have been searching for about an hour on how to do this in Excel. I have an Excel file that was created from an old system and I am pulling information from a SQL Server Database, I will be inputting the information back into the SQL Server Database and would like the Dates to match. I have tried Creating a Custom Format, but I am unsure if I even did it Correctly. I found several places where they want to go the other way mm/dd/yyyy to yyyymmdd but they have not been helpful. I am

How to copy data from one worksheet to another with condition

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-26 04:27:31
问题 Hope someone can assist me with my issue. I want to copy specific columns and rows to another worksheet after the condition is met. my worksheet consist of 43 columns where in I have to copy only 29 columns. 回答1: The range for the code example below looks like this Column A : Header in A1 = Country, A2:A? = Country names Column B : Header in B1 = Name, B2:B? = Names Column C : Header in C1 = Gender, C2:C? = F or M Column D : Header in D1 = Birthday, D2:D? = Dates This example copy all rows