Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need code for simple IF-Then
I'm trying to insert an "X" in any empty cells in Row 7 for columns C,D
E & F. I'm formatting all the cells in a large block (columns A - R, with a varied number of rows), but the results using CurrentRegion won't extend out past columns C - F when they are empty, which they usually are. I could include a macro to insert the X's, but sometimes these columns actually DO have data in them, and I don't want to overwrite any data. THANKS |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need code for simple IF-Then
Hello excelnut1954, Here is simple macro to fill in the empty spaces. Copy and Paste this code into a VBA project module. Code: -------------------- Public Sub XFill() Dim C As Long For C = 3 to 6 If Cells(7, C).Value < "" Then Cells(7, C).Value = "X" End If Next C End Sub -------------------- Sincerely, Leith Ross -- Leith Ross ------------------------------------------------------------------------ Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465 View this thread: http://www.excelforum.com/showthread...hreadid=483342 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need code for simple IF-Then
Hello excelnut1954, Here is simple macro to fill in the empty spaces. Copy and Paste this code into a VBA project module. Code: -------------------- Public Sub XFill() Dim C As Long For C = 3 to 6 If Cells(7, C).Value = "" Then Cells(7, C).Value = "X" End If Next C End Sub -------------------- Sincerely, Leith Ross -- Leith Ross ------------------------------------------------------------------------ Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465 View this thread: http://www.excelforum.com/showthread...hreadid=483342 |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need code for simple IF-Then
Excellent!!! I really appreaciate this. I've taken an in-house class
on VBA where I work, but of course, that was just the start. I got an 800+ page book on VBA, but it barely touches on the If-then coding. I've learned alot just playing around with everything, so I can do quite alot now. But, I really needed this to complete a project of automating a spreadsheet I designed here before, so others can update daily info without being an expert in Excel. Thanks for getting me over this hurdle, and for the quick response. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need code for simple IF-Then
Hi. Just another option:
On Error Resume Next [C7:F7].SpecialCells(xlCellTypeBlanks) = "X" HTH -- Dana DeLouis Win XP & Office 2003 "excelnut1954" wrote in message oups.com... Excellent!!! I really appreaciate this. I've taken an in-house class on VBA where I work, but of course, that was just the start. I got an 800+ page book on VBA, but it barely touches on the If-then coding. I've learned alot just playing around with everything, so I can do quite alot now. But, I really needed this to complete a project of automating a spreadsheet I designed here before, so others can update daily info without being an expert in Excel. Thanks for getting me over this hurdle, and for the quick response. |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Need code for simple IF-Then
Thanks Dana. I'll have to check and see how this works different than
what Leith gave me earlier. They both seem to work for that I'm doing in this project. Thanks again. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Help with some simple code | Excel Discussion (Misc queries) | |||
Simple Code, I think... | Excel Worksheet Functions | |||
Want a simple VBA code. | Excel Programming | |||
need a simple code | Excel Programming | |||
simple code | Excel Programming |