I am trying to write a macro using If...Then

I am trying to write a macro that will look at the value in column G.  If 
that value is blank or zero, then select the entire row and delete it. Then I 
want it to populate columns A with a number "111119" and column H with "TEXT" 
 Here's what I tried, but it's not working.

(There are other sorts, etc. that precede this item in the macro, that seem 
to be working fine.)

     If Range("g:g") < 1 = true
    Then ActiveWorkbook.Worksheets("Tab3 Upload").Rows.Select
    Selection.Delete
    End If
    If Range("b:b") > 1 Then
    Range("a:a").Select
    Selection.Fill "111119"
    Range("h:h").Select
    Selection.Fill "TEXT"
    End If
End Sub

0
Utf
3/22/2010 2:51:01 PM
excel.misc 78881 articles. 5 followers. Follow

1 Replies
835 Views

Similar Articles

[PageSpeed] 42

Your question is not clear. Did you want to look at the values of each 
individual cell in the column and make decisions based on those values? So if 
Cells G2, G4, G6 are blank then delete rows 2, 4 and 6 while leaving the 
rest? Are the values in G based on formulas or are they constants?
-- 
HTH...

Jim Thomlinson


"AJ" wrote:

> I am trying to write a macro that will look at the value in column G.  If 
> that value is blank or zero, then select the entire row and delete it. Then I 
> want it to populate columns A with a number "111119" and column H with "TEXT" 
>  Here's what I tried, but it's not working.
> 
> (There are other sorts, etc. that precede this item in the macro, that seem 
> to be working fine.)
> 
>      If Range("g:g") < 1 = true
>     Then ActiveWorkbook.Worksheets("Tab3 Upload").Rows.Select
>     Selection.Delete
>     End If
>     If Range("b:b") > 1 Then
>     Range("a:a").Select
>     Selection.Fill "111119"
>     Range("h:h").Select
>     Selection.Fill "TEXT"
>     End If
> End Sub
> 
0
Utf
3/22/2010 3:12:01 PM
Reply:

Similar Artilces:

newbie , how can I use gdi+ lib
hi , I have downloaded and placed the gdiplus.dll in system32 directory of win98 and use loadlibrary("gdiplus.dll") to bring this up however, the ide post me a complie error. what going wrong for this, thanks Eric Why don't you just statically link it into you project, put gdiplus.lib in the objects bit of the linker settings, or use #pragma comment( lib, "gdipluss" ) in your stdafx.h? M "Eric" <pgeric888@hotmail.com> wrote in message news:O0XrNgDsEHA.736@tk2msftngp13.phx.gbl... > hi , I have downloaded and placed the gdiplus.dll in system32...

Macro to Fomat Excel to .csv File
I have an Excel spreadsheet with contact information I want to import to a CRM lead system. Current Excel sheet format is all in one column going down as follows: Company Name, Address, City State Zip (all one field), Phone number, then empy cell then repeat of 4 cells listed above. Want to convert to a new .csv file with listing going left to right on on line as follows (ending up with 6 column fields - 1. Company Name 2. Address 3. City 4. State 5. Zip 6. Phone Any suggestions on how to accomplish this? Thanks. Kip ...

import data from Oracle database into Excel using vba
Has anyone an example of importing data from an Oracle database into Excel using VBA? ...

can't figure out the formula to use
Hello, I have a SS with 3 columns that look something like this: A:(NAME) B:(Agency[Vlookup Result]) C:(Formula Result) Jones, Joe Agency1 Agency1 A-M Smith, Bob Agency2 Agency2 N-Z Kid, Gregg Agency3 Agency3 Rohl, Jim Agency4 Agency4 **column B is a result of another sheet in the workbook... I am trying to find a formula that would follow this logic: if the 1st letter in A1 is between A-M, and B1 is "Agency1" or "Agency2", then C1 will be 'B1&"A-M"'. i...

what template should i use for collecting monthly payments from m.
...

i get error 404 not found when trying to download
I'm trying to download nokia pc suite to windows xp to upload gallery onto the computer but get error message404 not found - how can i download this pc suite please -- Krysy Albutt Krysy Albutt wrote: > I'm trying to download nokia pc suite to windows xp to upload gallery > onto the computer but get error message404 not found - how can i > download this pc suite please Care to enlighten us how this pertains to: - 1) Microsoft 2) Publisher 3) Windows If you're having problems downloading from the *NOKIA* site where do you think you should be directing your ...

Does any one ever use function capFileSaveDIB?
I use VS .NET 2003. I had connected to a USB camera. I tried to capture the image. The function capFileSaveDIB is used. MSDN said this function would return true if successful. I call the function like this: int cameraCapture(HWND hWndofCap, CString pathCStr) { char* pathStr = ""; strcpy(pathStr, pathCStr.GetBuffer()); pathCStr.ReleaseBuffer(); if (capFileSaveDIB(hWndofCap, pathStr)) return 1; else return 0; } I get the return value: 1. However, I don't get the picture where pathCStr pointed. I don't understand. Have you met this problem? I can't find out wh...

How can I make a dinner seating arrangement using Excel?
I would like to make a seating arrangement for three round tables and 22 people using Excel. Is this possible? ...

programs for shelter use
I am opening a animal shelter located in my county and I want to find a program that may help me run my shelter computerized. Any suggestions on any programs I can use and where I may purchase those programs? ...

MACROS #27
MACROS AND THEIR FUNCTIONS INTENDED code written in visual basic to automate certain repetitive procedures or certain other tasks that cannot be performed through the regula functionality provided by excel/word, or some new customised functio that needs to be created for a specific need, or to simplify cumbersome task that would otherwise take a substantial amount o effort... etc... etc... etc... try to keep your questions outside the realms of juvenility. help is privilege and not a prerogative -- Message posted from http://www.ExcelForum.com ...

Need help opening an Access DB using CDaoDatabase
When trying to open an existing Access DB (.mdb) I get the following exception: "Unrecognized database format 'C:\path...\database.mdb' I am trying to use CDaoDatabase as follows: CDaoDatabase m_accessDb; m_accessDb.Open("C:\\path...\\database.mdb"); Invoking the Open member function throws the DAO exception. Thanks in advance, Jim "Jim Fleming" <jimfleming@charter.net> wrote in message news:10n5t7cri98137a@corp.supernews.com... > When trying to open an existing Access DB (.mdb) I get the following > exception: > > "Unrecognized d...

Using two Network Adaptors
Hi, I have a new Windows 2003 R2 Standard server running Exchange 2003 Standard. The server has two Broadcom 1Gbps network cards in it. I used the Broadcom software to Team these cards for Load balancing and Failover. Unfortunately, after running for a month or so I started getting errors where the Exchange server couldn't reach the DC's. I removed the Team and am using just one of the Network adaptors and everything is back to normal. It may be the other adaptor is faulty and I will check that out next weekend. What I would like to know is what is the best way to use this two ...

Using my own letterhead on Pub. 2003
I am trying to create flyers using my own letterhead (saved in Word) on Publisher 2003- how do I insert it into a Publisher template or document? -- Wendy Kaye Copy/paste? Have you tried to recreate the letterhead in Publisher? You can save as a template. -- Mary Sauer http://msauer.mvps.org/ "WKaye" <WKaye@discussions.microsoft.com> wrote in message news:270763A7-512A-4DF5-85C0-BB400C3BEBAB@microsoft.com... >I am trying to create flyers using my own letterhead (saved in Word) on > Publisher 2003- how do I insert it into a Publisher template or docu...

Looking for POS for Grocery/Deli using GP. Anysuggestions?
6-10 stations ...

Can you perform ctrl+shift+; in a macro to display time?
I would like to add current but static time to a cell within a larger macro, but the only way I can find to enter just the time and not date as well is to use ctrl+shift+; but it doesn't appear that macro allow the use of hardkeys, although my knowledge of macros is basic i'm sure there must be a work around. Hi Darran Try: '=============>> Public Sub TesterC() With Range("A1") .Value = Time .NumberFormat = "h:mm AM/PM" End With End Sub '<<============= --- Regards, Norman "Darran Parsons" <Darran...

Getting "Enter network password" when trying to administrating PF
Hi We are now, suddenly getting "enter network passord" on the whole Public Folder tree. If we change folder or trying to access the properties on a folder. We didnt get this until recently (last days) Anyone that knows why we migt recieve this? It is exchange 2003 Ent. ...

Blocking fields to avoid use in formulas
Is there any possibility to block the particular field in order to avoid users to use invalid fields in formulas ? regards Peter You can lock and unlock cells (then protect the worksheet) so that users can't change certain cells. But if you allow them to type a formula into a cell, then I can't think of anyway of stopping them from pointing at A1 when A1 shouldn't be used. Is that what you meant? If it is, maybe someone else has a way... If it's not, maybe you should rephrase your question. Piotr wrote: > > Is there any possibility to block the particular field i...

User-inserted external file path used to pull cell values
I have an organization that wants each vendor to fill out and submit a net present value worksheet as part of the RFP process. Call it the NPV workbook. The organization wants to then pull data from each of those worksheets into a summary worksheet. I would like for the organization to be able to input the file path for each NPV workbook. Then the summary cells would use the file path to pull the data. What I have been trying so far isn't working: 1) Organization creates a hyperlink to each NPV workbook; example: Cell B8 contains the hyperlinked string: F:\Emergent\Projects\03109 GSA ...

How to Get OperatingSystem User using Macro
Hi, I would like to display the Operating System User using VB Macro in Excel. I am using Ms Office 2000 Thanks Regards Mili Mili, You can use Application.OperatingSystem to return a string describing the operating system. E.g., Msgbox Application.OperatingSystem -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com chip@cpearson.com "Mili" <mili_rao@yahoo.com> wrote in message news:0b2b01c3a453$7481cb90$a301280a@phx.gbl... > Hi, > I would like to display the Operating System User > using VB Macro in...

Post disappeared -- "paid using the address information"
I posted this last week and I don't see my post or any replies. What exactly does Money mean when it says "this payee is paid using the address information"? Does it mean that MSN Bill Pay prints and mails a check to the payee? When I e-pay my Comcast bill, Money 2003 gives it a date that's two days from now. My other e-pays initially get today's date in the register (until the check clears, when it changes to the check cleared date). I wonder why Comcast gets a different date than other e-pay'ees. The Comcast bill has sometimes cleared two days after I e-...

Can the IFS kit be used freely?
Hello. I know the IFS kit is distributed as part of the WDK. Does it means the IFS kit can be used freely? Or, shoud it be purchased? If it should be purchased, where can I buy its license? Thanks. > I know the IFS kit is distributed as part of the WDK. > Does it means the IFS kit can be used freely? Yes. --=20 Maxim S. Shatskih Windows DDK MVP maxim@storagecraft.com http://www.storagecraft.com ...

How to convert numbers using dots into numbers using commas
I have an Excel sheet with a specific range of cells that contain numbers. The format of these cells is "General" (so not "Number"). The numbers in these cells use dots (e.g. 4.2) while I work with commas (e.g. 4,2). Does anyone know how can I convert the numbers into numbers that use commas? If your system is set to use commas as decimal point you should be able to select the range of cells with dots and Edit>Replace what: dot(.) with: comma(,) Replace all. Gord Dibben MS Excel MVP On Tue, 5 Dec 2006 14:49:01 -0800, Martin <Martin@discussions.microsoft.c...

Are Pivot Charts only useful with limited number of categories(x-axis)?
I'm brand new to Pivot Charts and trying to figure out what I thought would be simple: I have a Column Chart with $Sales for the Y axis and Salesperson on the X(category) axis. There are hundreds of salespeople, which results in the chart displaying extremely thin lines with totally unreadable category labels( salesperson initials). Is there not a way to specifiy a gap between categories on the X axis? Or some way to space them apart and be able to scroll the chart horizontally? I have a feeling you are all going to tell me scrolling is just a dream :) TIA, -Mike ...

Macro to count inline images
I have to format about 10000 word docs that are generated from another source for a test report. I have built a a macro to do the formating for me but I would rather make it more automated. I have two differnt reports, the only difference between them is the number of inline objects. 1. How do I count the number of inline objects? 2. How do I automate word to run the module on a directory (including sub-directories) 3. How to Save-as in order to maintain the originals? Thank you! Hi Tith, For a given document, you can use a macro like: Sub InlineShapeCount() Dim i As In...

how can i produce regional maps with demographic data using excel.
I was wondering how can I use excel to produce regional/city visualization maps with demographic data Pedro, This post might help: http://www.automateexcel.com/index.php/2005/03/18/where_do_i_get_an_xml_map ---- Regards, John Mansfield http://www.pdbook.com "Pedro" wrote: > I was wondering how can I use excel to produce regional/city visualization > maps with demographic data Hi John, You may be confusing XML data maps with the MS Map addin program that use to be included in XL2000. Cheers Andy John Mansfield wrote: > Pedro, > > This post might help: >...