.value

  1. N

    Shape cut and paste in VBA

    Hi I have this code (Below) and I want to cut and paste Shape "C" to Sheet 2. What I need to change in the code so that Shape "C" will work in Sheet 2? Option Explicit Private Sub AdjustTank(ByVal CurLevel As Double, ByVal TankID As String, _ Optional MaxLevel As Double = 400000) Dim Tank...
  2. V

    Fill Blanks

    the below code works very well, but if there isn't any blank cells it gives a error, any idea as how to modif the same. Sub Fill_Blanks() With Range("M5:M" & Range("J" & Rows.Count).End(xlUp).Row) .SpecialCells(xlBlanks).FormulaR1C1 = "=R[-1]C" .Value = .Value End With End Sub
  3. G

    VB code help please

    How do I restructure this part of the code, to put todays year, month, and date, before this part of the code? Private Sub Workbook_Open() Dim Ans As String Ans = MsgBox("Update Invoice Number (???)", vbYesNo + vbInformation) If Ans = vbYes Then Example: 2018121773 ...
  4. J

    Check a cell and add a value in another cell.

    Hi, I am trying to do the following In column A from A2 downwards if a cell I notblank then the cell in column F will contain todays date "NOW()" ie, Cell A2 is not blank therefore cell F2 will contain todays date. I am using this VBA at the moment, but it does not work. Sub Start_Date()...
  5. V

    Array Formula

    Hi, I have this code and its not working on VBA, but applied with Ctrl+Shift+enter manual its works. With Worksheets("Sheet2") 'Rank With .Range("G5:G" & .Range("A" & .Rows.Count).End(xlUp).Row) .FormulaArray =...
  6. B

    loop with lastrow

    How would I change a5000 to last row? Sub PosX() Dim r As Range Dim i As Long Dim LastRow As Long Set r = Range("A1:A5000") For i = r.Rows.Count To 1 Step -1 With r.Cells(i, 1) If .Value = "POSNX" Then Range("A" & i + 0).Range("$h$1").FormulaR1C1 = _...
  7. S

    Getting #REF result from FormulaR1C1 = "=R[-1]C"

    I am trying to copy a value in a cell to the blank cells below. I have the following: Dim LastRow As Long LastRow = PLSR.Cells(Rows.Count, 2).End(xlUp).Row Copy Employee number in Column A to blank cells below With Range("A1:A" & LastRow) .SpecialCells(xlBlanks).FormulaR1C1 = "=R[-1]C"...
  8. S

    Export and save IF a specific sheet exists

    Here's my code: Function Export() Dim Fname As String, ws As Worksheet Fname = "Vesting Review - " & Sheets("Instructions").Range("D5").Value Sheets(Array("VDR", "SP", "DDR", "VOR", "TDR")).Copy For Each ws In ActiveWorkbook.Worksheets With ws.UsedRange .Value = .Value End With...
  9. M

    assign value

    Hi, I just noticed something about assigning worksheet values to vba variables. age1 = Worksheets("Inputs").Range("Age") is the same as age1 = Worksheets("Inputs").Range("Age").value I guess if the .value is missing it uses the default? Doesn't it seem better to throw an error in this...
  10. D

    Type Mismatch issue

    Hi all. I have a userform with 3 TextBoxes (ones having an issue anyway) to adjust the value in the respective cells on an Employee Information worksheet. The Balance is shown as a label.Caption using Application.VlookUp for the employee shown in a ComboBox called Reg2. Reg9, Reg10 and Reg11...
  11. ACommandLineKindaGuy

    When is a number not a number?

    I have the following code to check the input of a Textbox. So, for say TextBox301, I call a routine to validate the number I enter. I have a lot of groups of TextBoxes and they all have different maximum integer values, so I pass the maximum value using public constant n: <code>Private Sub...
  12. T

    Case in VBA

    For some unknown reason, when I type: .Value VBA changes it to: .value Does anyone know why?
  13. R

    Evaluating a Formula via VBA

    I have a record set with ~17K records, but I only need to see ~500 of them. I'm unable to alter the source of the data that I receive, so I'm trying to delete the rows I don't need, via VBA. I haven't tried using the Evaluate function before, and for some reason, I'm not able to get this to...
  14. M

    Novice Needs Help with Macro

    Hello All, First let me state that I am a complete novice to macros and vba. However, I am able to reverse engineer existing macros and vba code to en extent. I was able to locate the macro below from this this forum. I made some changes to suit my needs and it works beautifully. My problem is...
  15. H

    Replace Weeknum formula in VBA

    Hi, I'm trying to get rid of code that places formulas in cells. One of the formulas I have is sheet1.Range("M3:M" & LastrowC).Formula = "=weeknum(K3)" I tried to massage the code below, but had no luck. Any suggestions? This works: With sheet1.Range("L3:L" & LastrowC) .Value =...
  16. ryan0521

    How can I simplify this one?

    'one If mwkb.Sheets("Cover Sheet").Range("ab11").Value = 1 Then Set Wkb = Workbooks.Open(PATH1) mwkb.Sheets("1").Cells.ClearContents Wkb.ActiveSheet.Cells.Copy mwkb.Activate Sheets("1").Select Range("A1").Select ActiveSheet.Paste...
  17. S

    excel getting corrupted after this RUN

    Hi, My Excel doesnt save after i run below VBA. with error msg as corrupted. Sub foo2()Dim x As Workbook Dim y As Workbook Workbooks("TimeSheet.xlsm").Activate ImportDir1 = Trim(Sheets("Control").Range("C5").Value) Workbooks("TimeSheet.xlsm").Activate ImportDir2 =...
  18. Z

    Copy cell data to another sheet and add date to cell with same checkbox

    Hi I have already a checkbox for adding date when is checked. Also on this checkbox i have rule for changing background on selected cells. I can't make it work when i want to copy from cells A3:C3 (sheet1) to A3:C3 (sheet2) Here is my code Sub CheckBox_Date_Stamp() Dim xChk As CheckBox Set...
  19. G

    Help with adding vba code to existing code

    Is there a way to code "Bid Calculator (C29:G29)" the number in the last cell before G29 example [c29 is 1, D29 is 2, E29 is 3], and F,G are blank. and add the cell E29 is 3 to this [CODE]With Sheets("Legend").Range("R4") .Value = .Value + 1[CODE/] Lets say R4 gives the number 4 and E29 is...
  20. C

    VBA Code Terminating 1 Row Too Early

    Hello, The formulas in the VBA code below work perfectly for what I'm wanting to achieve; however, I notice that it's terminating 1 row before the last line of data. I thought the "offset" might have something to do with it so when I deleted it, it wreaked havoc, haha. I think the "offset" is...

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top