Tab Or Align VBA Code
Nov 20, 2008I have several lines of code written in VBA without any tabs. All the lines of code are starting in same column.
I need to align the code, so that it is easy to understand.
I have several lines of code written in VBA without any tabs. All the lines of code are starting in same column.
I need to align the code, so that it is easy to understand.
Using VBA, how would I move an existing shape object over to the righthand margin?
I suppose what I need is something like:
VB:
ActiveSheet.Shapes("Picture 1").Left = activesheet.margin.right - ActiveSheet.Shapes.("Picture 1").Width
But how do I find "activesheet.margins.right"?
I would like to align a group of columns against another group of columns.
Columns G-L will not be changing. They have a certain amount of info I want to align with columns A-F
There are 30000 items in G-L and only around 3000 so far in A-F
Weekly I will import and reorder A-F and then want to realign them with G-L
This is a link to a sample of the original file: [URL] .....
This a link to how I wan the order to be : [URL] .....
As you can see there are many more rows in columns G-L
I will update columns A-F weekly and then want to realign G-L
I need a single cell to contain two elements, one left aligned and the other right aligned.
Result would look something like this, LeftText aligned to the left side of the cell and RightText aligned to right side of the same cell.
LeftText {all of the white space here between two text values} RightText
Merging columns is not an option; both values must be in same cell. Both text values vary in length with each run of the code.
All I can do as of now is plug in a bunch of spaces that will approximate the open space between the two values.
This is a pretty simple request, but i need a macro to Find Column M's Last Entry and to copy down the 3 following columns down to the value.
I need it to be dynamic in other words, The length of column M will vary depending on my file . If the macro knows Column M ends Here, then drags the boxes down starting from N3 to Q3 down to the last Entry in Column M.
I have a task that I need to perform every now and then. And even though I normally find my ways around in Excel, I can't find a working solution for this one.
I have a list of features that I need to match with another list and place them on the same rows in my sheet. The attached file contains 2 worksheets where "Before" shows my normal input, and "Wanted" shows what I need to do.
Cols A-E contains info for the first set of features, cols G and H is the cells I want to move. Please note that sometimes the G and H columns contains info that are not present in A-E, and then I need to move those features around as well. An example is present at the bottom of the "Wanted" sheet.
I have 2 columns one with blanks one without, the data can be anything. I need the 2 columns to line up, data matching up and blanks matching up. I'm attaching a spreadsheet with an example.
View 3 Replies View RelatedIn the attached workbook there is a UserForm with five (5) command buttons along the bottom of the UserForm. I'm familiar with making them the same size and aligning tops. What I'm struggling with is how to distribute them horizontally. That is, to get the same amount of "white space" between them.
View 9 Replies View RelatedI have a table that has:
in column a an number 1,2,3,4,5,6
in column b I have a code against each number
in column e I have numbers , 1,1,1,1,1,2,2,2,2,3,3,3,4,4,4 etc ....
What I would like to have is the code from column c replicates in column d that's matches the code from column c
I have attached a sample of what I need : Product Detail - Copy.xls‎
I've fought with this issue off and on for some time now and decided it was time to come to you for help. In the attached workbook there is a UserForm with five (5) command buttons along the bottom of the UserForm. I'm familiar with making them the same size and aligning tops. What I'm struggling with is how to distribute them horizontally. That is, to get the same amount of "white space" between them.
View 8 Replies View RelatedI need to shift all the cells in columns B, C, D, E & F up a row to align with the names in column A.
I have code to delete the empty rows.
Start:
Bank Holiday 1 on a Week End
ABCDEF1YASMIN AKHTAR (YA1) 2 59038.753MARINA BELAIDI (MB2) 4 12325.55MARGARET CANT (MC6) 6 33002.25
Result Required:
Bank Holiday 1 on a Week End
ABCDEF1YASMIN AKHTAR (YA1)59038.752 3MARINA BELAIDI (MB2)12325.54 5MARGARET CANT (MC6)33002.25
I have to filter data in one column and have it align with data in another column. I need to do this because I have hundreds of product descriptions that I need to match up with the appropriate images. All of the image names will be like the first row (1244-?????.jpg) The problem I am running into the text data I am downloading is not matching up with the images. I usually have more images than text and sometimes I will have text that has no corresponding image.
1244-540299.jpg Golden Poinsettia Triple Candleabrum 1244-540299.jpg
http://img.auctiva.com/imgdata/1/3/2/1/0/4/0/webimg/539293145_o.jpg
1244-540300.jpg Poinsettia and Berry Triple Candleabrum 1244-540300.jpg
[Code] ...........
raw data
(format number general & center align)
desired result
(keep format number & keep center align)
0
-
1
1
2
2
0
-
0
-
it's possible without VBA Coding?? assuming mark "-" is not text but instead number "0"...
I am trying to align a picture on the right of my worksheet. The far right column changes depending on user selections from a userform.
I am using
ActiveSheet.Shapes("Picture 1").Top = Range("J2").Top
to align the top
I did find code to align to the left, but right doesn't seem to be valid.
I am trying to get two shapes to butt up to each other. Unfortunately the shapes either leave a small gap or a slight overlay. I have tried using Ctrl + arrow key to move in small increments, but that didn't work. I have also tried adjusting the width of the rows, but the rows jump backwards or forwards to a number instead of staying with the number I entered. I want to create a seamless shape out of many different shapes.
View 6 Replies View RelatedI have the following code,
i would like to select columns A:W and center the text
Private Sub Workbook_NewSheet(ByVal Sh As Object)
Sh.Range("A1") = "W/O"
Sh.Range("B1") = "CUSTOMER"
Sh.Range("C1") = "DETAILS"
Sh.Range("D1") = "CUST PART NO"
Sh.Range("E1") = "STATUS"
Sh.Range("F1") = "NOTES"
Sh.Range("G1") = "DEPARTMENT"
Sh.Range("H1") = "DATE"
Sh.Range("I1") = "CUST ORDER NO"
Sh.Range("J1") = "DEL NO"
Sh.Range("K1") = "QTY"
Sh.Range("L1") = "SALE PRICE"
Sh.Range("M1") = "CARRIAGE OUT"
Sh.Range("N1") = "TOTAL SALES"
Sh.Range("O1") = "INT CODE"
Sh.Range("P1") = "SUPPLIER"
Sh.Range("Q1") = "COST PRICE"
Sh.Range("R1") = "CARRIAGE IN"
Sh.Range("S1") = "TOTAL HRS"
Sh.Range("T1") = "LABOUR COST".......................
Here's a weird one: I can't get some of my cells to align to center/left/right. Both the buttons on the toolbar and Format->Cells->Alignment won't work. The kicker is that other cells on the same sheet will center/left/right just fine. Is there some kind of formatting protection I inadvertently set?
fyi, Excel 2003 on XP Pro, all fully updated.
Example Table A:
*ABCDEFGHIJKL1No. 1No. 2No. 3No. 4No. 5No. 6No. 7No. 8No. 9No. 10No. 10No. 10221418269124333324171165141728884321000125067775100860615906015712170712180910
Result Table B:
*ABCDEFGHIJKL1No. 1No. 2No. 3No. 4No. 5No. 6No. 7No. 8No. 9No. 10No. 10No. 10263214854241121253210609433610178011412288370151076151767788070121206015907910
What i want here is to align all the numbers considering the last used cell. In example table a; the last number is 0 (F8). Considering that, in the Result table B all the numbers are aligned in row 8 from the bottom to top giving an equal alignment to the table.
I am trying to create a data sheet to simplify the filling of corporate documents on our company computer systems. I have a working system, flawed, but working. What I want is to simplify it and correct some mistakes I made when I first made it. At the moment the priority is the field for our serial numbers. They vary from 1 to 10 digits in length with a alpha-numeric system. Some serial numbers even include hyphens, but the hyphens need to be removed for the forms. My system uses a modified form to allow for hyphens, but my boss wants them removed. ^^'
Anyways, the serial number of an item is entered into the data sheet field and my macro breaks down the serial number piece by piece. On the form the there are ten blocks for each digit of the serial number and I have coded the macro to put one digit per box. The trick is that the serial number must be right aligned and any empty fields must stay empty. This is where my request comes into play. I have already programmed the macro to do everything required except remove hyphens. The problem is that it is a REALLY long macro using If Then End statements to to compensate for the varying lengths of a serial number. Is there anyway to simplify this task?
Public Sub SerialNo()
Sheets("Data").Select
Dim SerialNo As String
Dim SerialNo1 As String
Dim SerialNo2 As String
Dim SerialNo3 As String
Dim SerialNo4 As String
Dim SerialNo5 As String
Dim SerialNo6 As String
Dim SerialNo7 As String
Dim SerialNo8 As String
Dim SerialNo9 As String
Dim SerialNo10 As String
I am a PhD student and have a series of coordinates for various DNA sequences. I need to generate an excel chart which will show all the sequences aligned one on top of the other, not like a stacked bar, but where no gaps are found between the bars. So that they appear as if they have ‘fallen down’ as you would see with ‘Tetris’. This would end up with a bell shaped chart, rather than a messy chart. I need to do this to demonstrate which sections of the entire sequence appear more often. Can this be done using VBA or is there a way to modify a chart? I have no previous experience using VBA so I'm close to pulling my hair out.
I'd like to align the text in comboboxes to be centred vertically - purely cosmetic I know, but "pretty = better" in my book!
View 3 Replies View RelatedIs there a way where i can have the figures in Red align with the corresponding description.
As it is when i run my report the account code will come on top of the description and i want to find a way to align them in the yellow cells.
Are there any custom formats i could use to center align a particular text in a cell if it is chosen in a dropdown validation (example: N/A)?
I would like "N/A" to be aligned in the center and all other choices aligned to the left.
I have a tab with several small tables (Column E-G). What I need to do is to copy them as pictures, move them to another tab, change the picture size, and align them in the new tab.
The data set is huge and it would involve lots of labor if copy and paste one by one. Is there any way to do it using a macro? I tried to record a macro, but it doesn't work. It will not change the size of the picture and I don't know how to tell Excel to align them the way I want.
How To align (set tabs or columns) on a text string ....
View 8 Replies View RelatedI have a list similar to the one below. I need to compare four columns against each other and align matches alphabetically.
This is the data:
Nov
Dec
Jan
Feb
[Code].....
I tried using VLOOKUP but I can't figure out how to get it to return what I want in the format I want it.
I have a report that has a set template except that the number of columns change.
I have 3 rectangular shapes with text boxes inside each rectangle. The Shapes take up space vertically between row 8 and 15. In some reports the columns will change, the size of columns might change due to longer text. Is there a macro that will select all the shapes and text boxes and center them column wise between the print area?
Following my bosses recent charting attempts involving multicoloured backgrounds, graduated bars, textured boxes, mis-matched fonts etc, etc, which frankly showed no information whatever, I was asked to simplify them.
I did so, as in the two attachments, but the response is now along the lines of "well, yes, but they aren't very exciting, are they?"
My goal is to match two outputs from a database so that the same person's record can be found on one row. At present output 2 does not marry up to output 1 due to staff leaving and new appointments being made. The data in output 1 should remain static. The data in output 2 must be manipulated to match the order of output 1.
Output 1 is a 5 column record containing (in A6:E6)
Forename, Surname, Branch, Roll Number, and a % score
Output 2 is again a 5 column record containing (in G6:K6)
Forename, Surname, Branch, Roll Number, and a % score
Each employee can be identified by a unique Roll Number Code contained in the fourth column of each record.
If an ideal match has been found I'd like the letter Y to be inserted in the L column of each record to signify a positive comparison. All non matches should have the letter N in the L column & these non matches should be placed at the bottom of the dataset.
I know how to center text from left to right, but how about from top to bottom?
View 3 Replies View Related