1.value

  1. L

    Help to combine two Private Sub Worksheet_Changes

    Hi, I am using VBA to automate values in a specific column for a tracking sheet. It works great but as always is the case I am wanting more. Can anybody help me reorganise these 2 pieces of code so that they work simultaneously in the same worksheet change? Here is the code: Private Sub...
  2. R

    VBA that worked in Mac 2011

    Hello All, This macro worked great in Excel mac 2011 but does not work in the current version. It actually crashes Excel so it cant be debugged. It would print all the pages of each sheet in my workbook. Can some explain why it no longer works and how to fix it? Sub prtme() Dim Answer As...
  3. H

    Date and time formats in VB

    I have the following script Sub ListAllFile() Dim objFSO As Object Dim objFolder As Object Dim objFile As Object Dim ws As Worksheet Dim sPath As String Dim lrA As Long Dim lrB As Long Set objFSO = CreateObject("Scripting.FileSystemObject") Set ws = Worksheets.Add 'Get the folder...
  4. C

    Getting the formula in this For loop to include the current column(colnum)

    This code Dim X As Range Sheets("Budget").Select For i = colnum + 1 To 54 Cells(30, i).Value = Cells(30, i - 1).Value - Cells(18, i).Value If Cells(30, i) = 0 Then MsgBox "Balance is 0 at col " & i & " " & " and week " & Cells(2, i) Range(Cells(30, i...
  5. C

    Translate Vlookup to vba code

    Hi, I have two workbooks and I need to match the first column of both of their first worksheet(ws1, ws2) first column(A). If match happens then it will return the matching row with 3 columns (A, F, AK) to the first worksheet. i have this Vlookup...
  6. H

    List folders?

    How can I modify this code to list the folders within a directory? I tried ... unsuccessfully Sub ListAllFile() Dim objFSO As Object Dim objFolder As Object Dim objFile As Object Dim ws As Worksheet Dim sPath As String Dim lrA As Long Dim lrB As Long...
  7. P

    Passing data from one userform to a formula on another userform

    In the code below, I declared lDz and lCs as public variables so I can use them in a formula located on another user form. Unfortunately the values will not pass to the formula and I get a Run-time error '11': Division by zero. I even created invisible text boxes and tried to assign the values...
  8. S

    Using NumberFormat with Offset

    Hi guys, sorry again for a simple question but I cant seem to get it to work. If Weekday(rngCel) = 1 Then rngCel.Offset(0, 1).Value = 45 .NumberFormat = "0.00" If Weekday(rngCel) = 1 Then rngCel.Offset(0, 1).Value = Format(45, "Currency") I have tried with this...
  9. T

    Omit first row of array

    If my data has two columns in columns A and B but I just want column A, I can write this: MyArray() = Sheet1.Cells(1, 1).CurrentRegion.Resize(, 1).Value What can I do if I want to populate MyArray not from cell A1 but from cell A2? I don't want to have to loop. Thanks
  10. N

    Easy VBA syntax

    One more question... For Each Cell In Range("Contact") If Cell.Value = "I&S" Then Cell.Offset(0, 1).Value = "No" Cell.Offset(0, 2).Value = "Yes" end if The code works fine, but is it possible to include both outcomes in one line without a block if? something like - If Cell.Value =...
  11. Dreamteam

    Error when trying to loop through worksheets and cell ranges

    Hi I am trying to loop through worksheets - all with numerical worksheet names and then loop through a range of cells and add some prices. However, I am getting an error each time. I will say though that if I start to run the code when I am actually in one of the relevant worksheets then it...
  12. F

    Adding 10 Seconds to the Previous Cell Value

    Hello everyone,This is probably quite a simple request however I am having a lot of trouble with it.I would like to write to a cell the previous cells time value + 10 seconds. I have tried several approaches after a lot of googling, however below is what I started with and what I would like to...
  13. P

    Add additional text on the end of text copied from above

    I am using the following to copy text from above into the blank cells. I am wondering if anyone can help me with adding the word 'Total' on the end of the text copied from the cell above. Sub TextFromAbove() Dim columnValues As Range, i As Long Set columnValues = Selection For i =...
  14. T

    IF loop Set(s) value for Range: How to set it if = Nothing

    I have a column of dates/times. Then, within UserForm, Range looks for a value > BeginDate1. Everything works great (right until the error). What I am trying to do is set the value if there is nothing found in the loop. rng1st & rng2nd will then set posted data. When there is .Cell >...
  15. M

    Using Left in VBA

    Hi, I'd like to change the following code such that only the Left three characters of the Department value are taken. Left tutorials aren't helping me much. With ws .Cells(ERow, 1).Value = Me.ptmember.Value .Cells(ERow, 2).Value = Me.StudyRole.Value .Cells(ERow, 4).Value =...
  16. C

    If cell values are present in an array

    Hi, I have the following code below which works exactly as I want it to: If Cells(rowCount, 1).Value = Range("D2").Value And Not IsEmpty(Cells(rowCount, 1).Value) Then Cells(rowCount, 14).Font.Color = vbRed End If But now I want to the = Range("D2").Value section. Instead of if...
  17. most

    For each row, find the date in other sheet and return some values

    I need really need some pointers here, what is the best/easiest way to solve this? The code below doesn't work, so many different issues so I'm not sure there are any point for me in pointing them out. =) For each date in this sheet... ...find the date in this sheet return time and type to...
  18. C

    Getting a For Loop to work correctly on a range...

    This works correctly… For i = colnum + 1 To 105 Cells(30, i).Value = Cells(30, i - 1).Value - Cells(18, i).Value Next ...but this code performs the calculation all the way out to col 105 even if there are no values in cells(30,i) and cells(18,i) when this is not necessary and and...
  19. E

    How to use "AND" after THEN statement

    I have been using this below code. It basically copies the value from cell H5 everytime it changes to the first empty cell in column N. The problem is I need to copy H5 and I5 when H5 changes. I have tried adding AND like this: ...Then sh.Range("N" & Range("N" & Rows.Count).End(xlUp).Row +...
  20. sharky12345

    Remove blank rows from range

    I'm using this to sort data into different columns depending on a cell value; Sheet9.Range("P2:T40").ClearContents For Each Cell In Sheet9.Range("E2:E28") If Cell <> "" Then If Cell.Offset(0, 3) = "N" Then Cell.Offset(0, 11).Value = Cell Cell.Offset(0, 12).Value = Cell.Offset(0, 1).Value End If...

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