Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. VBA Help, probs really simple

VBA Help, probs really simple

Scheduled Pinned Locked Moved Visual Basic
toolshelptutorialquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    harveyhanson
    wrote on last edited by
    #1

    Hi, I need some help with a VBA script in Excel 2003, its probably really simple but the macro recorder hasnt been much use and im not sure how to start. All I want to do is: Check a worksheet value (i.e. in call A1), for the first value check on another worksheet list >> If this value is in a row, delete this row and all rows containing this value, if not, do nothing and check the next record Then move onto the next record (i.e. in cell C2) until there are no records left to check How would I do this please (or can you give me advise on how to do something similar so I can make a start at finding a solution?). Many thanks in advance

    P 1 Reply Last reply
    0
    • H harveyhanson

      Hi, I need some help with a VBA script in Excel 2003, its probably really simple but the macro recorder hasnt been much use and im not sure how to start. All I want to do is: Check a worksheet value (i.e. in call A1), for the first value check on another worksheet list >> If this value is in a row, delete this row and all rows containing this value, if not, do nothing and check the next record Then move onto the next record (i.e. in cell C2) until there are no records left to check How would I do this please (or can you give me advise on how to do something similar so I can make a start at finding a solution?). Many thanks in advance

      P Offline
      P Offline
      parth p
      wrote on last edited by
      #2

      I won't write code for exactly what you need but I have got similar example.

      Sub CheckList()

      Sheet1.Cells(1, 1) = "Text1"    'Set text in Sheet1
      Sheet2.Cells(1, 1) = "Text1"    'Set Text in Sheet2
      
      
      Dim sValueFromSheet1 As String
      Dim sValueFromSheet2 As String
      
      sValueFromSheet1 = Sheet1.Cells(1, 1)   'Get Value of Cell A1 on sheet1
      sValueFromSheet2 = Sheet2.Cells(1, 1)   'Get value from list on sheet2
      
      If sValueFromSheet1 = sValueFromSheet2 Then
          Sheet1.Activate
          
          'This will delete 1st Row
          Rows("1:1").Select
          Selection.Delete Shift
          
          Range("A1").Select
          
      End If
      
      ' Now for your question you will have to write your own code
      ' to do what you want to. I can't do everything for you.
      '
      ' Hope this example helps you.
      

      End Sub

      - Stop thinking in terms of limitations and start thinking in terms of possibilities -

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups