User Login

Forum Topic

excel macro programming

  • if A1 is blank or with any other text, B1 can be blank.
    however, if A1 = "closed", B1 should have a text.

    I don't think this can be solved by data validation. Data validation will only work if there is data entered, so that the data can
    be validated.

    But this can easily be solved by some excel vba.

  • I don't think this can be solved by data validation. Data validation will only work if there is data entered, so that the data can
    be validated.

    But this can easily be solved by some excel vba.
    i was thinking the same but i can't seem to find a solution. any idea?

    thanks!
  • Goto vba editor double click on thisworkbook to access the workbook and select sheetChange.
    Use the following code.

    Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)

    Sheets("sheet1").Select
    If Range("a1").Value = "closed" And Range("b1").Value = "" Then
    MsgBox "Please enter a value in cell B1"
    End If

    End Sub


    If B1 is empty and value in a1 is "closed" and sheet1 is changed (like changing other value in a cell or emptying the b1 cell) then that msgbox will appear




    -- edited by ram2010 on Dec 07 2015, 09:28 PM
  • @ram2010

    thanks.. YGPM
  • dotdll Send Message View User Items on November 18, 2015 09:56 AM #
    @ botsblitz32 and ram2010

    Bali ganito po ang scenario ito sample: bali yung x and y columns are their coordinates.

    This can be solved by excel vba of course. Are you still interested on the solution?
  • Mga master need help..
    Need ko print laman Ng text box ko. What I have now is print Sa form. But need ko Sana Yung mismong laman Ng text box gusto ko print upon click Ng Isang command button.

    Thanks in advance.
  • up
  • Zendrix Send Message View User Items on December 24, 2015 04:34 PM #

    I tried to create a form put a textbox and place a text in the textbox.
    I am able to print the text in the textbox.

    Is there any other details of your problem?
  • sir isa pa po..

    data like this.

    date name item
    1/1/16
    1/1/16
    1/1/16
    1/2/16
    1/2/16
    1/3/16
    1/3/16
    1/3/16


    what i want is to type like 1/3/16 in cell a1 then
    upon click a command button all data dated equal to a1 will be selected and
    transfer into another sheet.
  • Do like this.
    Create a button with a link to a macro.
    Your macro will scan column "a".
    The macro will record the value in a1 as its fixed value. When scanning a2, a3 ... compare it with the fixed value.
    If the same, then record the whole row to another sheet. Continue scanning column "a" exit when done.
  • Hi sir ram2010, I need help

    need ko mag karoon ng isang button para sa search engine means pag ng search ka lahat ng laman ng sheet tab masearch mo kung andun nga ung name nya, di lang po isang sheet tab, sample sheet tab 1/sheet tab 2/sheet tab 3/
    isang search engine lang kukunin na agad ung file na nakita nya..

    pano po ba gagawin dun sir my sample ka po sir ram. thanks po
  • Sir Ram Sample code nga po nung scanning?
  • Mga master ng vba,

    Patulong nman... I want to paste some pictures in chronological order ng file name na 1 to 45 na picture to a certain cell sa excel na automatic din magresize sa size ng specific cell. Possible kaya ito... file is located in a certain folder... sana may makatulong guys
  • Zendrix Send Message View User Items on January 27, 2016 04:05 PM #
    Sir Ram Sample code nga po nung scanning?


    Here is the sample code.

    Sub SearchAndCopy()
    'Search the value in a1 along column 'A' starting at a2
    'in sheet1 and copy the entire row to sheet2.
    'Add the word End at the end of column 'A' to terminate the scan.

    Dim destRng As Range
    Dim valueToSearch As Range
    Dim SrchRng As Range

    Set valueToSearch = Sheets("Sheet1").Range("A1") 'User input value
    Set destRng = Sheets("Sheet2").Range("A1") 'Start point of copied rows or destination
    Set SrchRng = Sheets("Sheet1").Range("A2") 'Start point of search

    Do While SrchRng.Value <> "End" 'Exit the search if value of cell is End
    If SrchRng.Value = valueToSearch Then
    destRng.EntireRow.Value = SrchRng.EntireRow.Value 'Copy the entire row to sheet2
    Set destRng = destRng.Offset(1, 0) 'Update destRng for next copy location
    Set SrchRng = SrchRng.Offset(1, 0) 'Update SrchRng to search the next range
    Else
    Set SrchRng = SrchRng.Offset(1, 0) 'Update SrchRng to search the next range
    End If
    Loop

    End Sub


    Sample data in sheet1
    1/29/2016 Name Item
    1/29/2016 Lego 2
    1/29/2016 Medicine 4
    1/28/2016 PC 7
    1/28/2016 Lantern 8
    1/27/2016 Chair 96
    1/26/2016 Pencil 14
    1/25/2016 Filters 87
    End


    Sample output in sheet2.
    1/28/2016 PC 7
    1/28/2016 Lantern 8
  • fmstatic14 Send Message View User Items on January 27, 2016 01:40 PM #
    Hi sir ram2010, I need help

    need ko mag karoon ng isang button para sa search engine means pag ng search ka lahat ng laman ng sheet tab masearch mo kung andun nga ung name nya, di lang po isang sheet tab, sample sheet tab 1/sheet tab 2/sheet tab 3/
    isang search engine lang kukunin na agad ung file na nakita nya..

    pano po ba gagawin dun sir my sample ka po sir ram. thanks po


    This is not clear to me.
    Ano itong,
    means pag ng search ka lahat ng laman ng sheet tab masearch mo


    Tapos at the end,
    isang search engine lang kukunin na agad ung file na nakita nya..


    Ano itong laman? at ano itong file na nakita nya?
  • wow try ko to sir ram...
    thanks po

Search TipidPC


Browse Items

New Want to Buys

Active Want to Buys