LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default VBA code to "skip" empty rows

This code will take text from column A in an Excel Work sheet and insert it
into column B inside a text box. I would like to tweek this to skip over
the code that creates the text boxes on each row that contains empty text.
The result I seek is to have a text box created with text copied from column
A and no text box created when column A is empty.

My attempt to do this myself is not working out. I am just starting to
learn something about VBA. Any comments for a better approach to solve this
would be appreciated. I have commented out my attempt to skip past the
textbox creation code until it can be fixed.
Quin


Option Explicit

Sub MakeTextboxes()


Dim iLeft As Long
Dim iTop As Long
Dim iWidth As Long
Dim iHeight As Long
Dim iRow As Long

iLeft = Range("B1").Left
iWidth = Range("B1").Width

For iRow = 1 To 5
' If Cells(1, iRow).Value = "" Then GoTo Skip


iTop = Range("b" & iRow).Top
iHeight = Range("b" & iRow).Height

With ActiveSheet.Shapes.AddTextbox(msoTextOrientationHo rizontal, _
iLeft, iTop, iWidth, iHeight)

.TextFrame.Characters.Text = Range("a" & iRow)
.TextFrame.MarginBottom = 0
.TextFrame.MarginLeft = 0
.TextFrame.MarginRight = 0
.TextFrame.MarginTop = 0


End With
'Skip:

Next iRow

End Sub
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Empty a cell if the values equal to "IN" , "MC" or "PP" YHT Excel Programming 1 December 28th 07 06:59 AM
delete rows if cell in row contains "a" or "o" or empty bartman1980 Excel Programming 2 November 4th 07 08:20 PM
VBA code to "reset" application run and empty preserved arrays [email protected] Excel Programming 2 May 9th 07 11:40 AM
Is there a way to set the "tab" key to skip certain cells/rows? mlacigam Excel Discussion (Misc queries) 0 May 18th 06 08:22 PM
transpose the code from "rows" to "columns" markx Excel Programming 4 September 21st 05 09:27 AM


All times are GMT +1. The time now is 01:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright 2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"