Macro To Hide Column With Relative Position
May 16, 2014
I am trying to hide a column titled "Test". This column is usually column E, but it is possible it can be moved to column D or F. If I use:
[Code] .........
Then column E is hidden, regardless of whether Test is moved left or right. The reason Test moves is due to the user inserting or deleting a column.
View 5 Replies
ADVERTISEMENT
Apr 9, 2014
My OS is Windows 7. My version of Excel is 2007. I have read how to get a macro to move around a page in a relative way, but is there a way to move from page to page in a relative way as well?
View 5 Replies
View Related
Jan 19, 2012
The data is a copy of CSV file in to a spreadsheet. Below is what the paste looks like:
100100 Books
1234.ab
1345.bf
1456
1567
100100 Books
100200 Magazines
100300 Videos
1234.ab
1345.bf
1456
1567
100300 Videos
All of the numbers between the 100100 Books, 100300 Videos belongs to that category. This repeats hundreds of rows down. I need the column to the left of this range to display which division it under. I parse this in excel so Books, Videos, Magazines will be in their own column. I am not exporting the CSV so have to manipulate it in excel. I need to have the column to the left combine the whole identifier so I can perform a VLOOKUP on it. It should look as follows:
100100.1234.ab
100100.1345.bf
etc.
My approach was to get the column to the left of the range to display the correct division, then have another column combine by using (cell)&"."&(cell).
View 1 Replies
View Related
Apr 2, 2007
I am trying to create a form with a text box that when text is entered, it adds to the userform another textbox with that data in it. The focus then goes back to the original textbox so that more may be added indefinitely, all with relative position to the most recently added textbox. Here is what I have so far, works for one time, but not multiple textboxes. The original textbox is "txtAPID"
Private Sub MakeNewTextBox()
Dim newTextBox As TextBox
Dim ControlTop As Long
With LastAirport
ControlTop = 30
End With
Set newTextBox = Me.Controls.Add("Forms.TextBox.1", "txtNextAirport", True)
With newTextBox
.Left = 20
.Top = ControlTop + 3
.Height = 15
.Text = txtAPID.Text
End With....................
View 2 Replies
View Related
Aug 1, 2008
I've got a list of story titles that are organized by genre, and I'd ultimately like to have a formula (not VBA) that automatically generates a "story id" based on the title's position within the genre (not the list overall). Here's a snippet of the list:
CREATE TABLES LIKE BELOW?IDGenreTitle
1.1GeneralTitle 1
1.2GeneralTitle 2
2.1Horror / SupernaturalTitle 3
2.2Horror / SupernaturalTitle 4
3.1Sci-FiTitle 5
3.2Sci-FiTitle 6
So what I'm looking for here is the formula that would give me the ID shown in the first column (I can modify it later for specific purposes). I've tried variations on the MATCH, INDEX, ROW, and VLOOKUP functions but just can't seem to get it quite right. Note: All the items in the Title column are unique - there are no duplicates.
View 3 Replies
View Related
Jul 14, 2014
I need to insert a picture on a Excel 2010 worksheet.
The worksheet contains a variable number of columns, and the column width is also variable.
The picture needs to be aligned such that the right edge of the picture is in line with the right side of the last used column.
This is so that when the worksheet is converted to a PDF document the picture (company logo) appears on the top right hand side of the page.
I can find the cell reference for the last column, and I can move the picture around the page. But I'm not sure how to find the position of the last column on the page?
I've got this far:
'copy picture and resize and position
Sheets("Output File").Select
ActiveSheet.Shapes.Range(Array("Picture 1")).Select
Sheets("External data sheet").Select
Cells(1, 10).Select ' I can make this be relative to the last column on the WS
ActiveSheet.Paste
Selection.ShapeRange.Height = 50
Selection.ShapeRange.IncrementLeft 0 'put the picture in a position relative to the cell selected
View 5 Replies
View Related
Mar 5, 2007
I need to change multiple conditional formats which apply to cell ranges 1 row x 17 columns wide. The specific change I am making is able to be acrried out with the code
With Selection.FormatConditions(1).Font
.ColorIndex = xlAutomatic
End With
However, I dont want the user to have to manually select each 17 cell area. I WANT THE USER TO JUST MANUALLY SELECT THE FIRST OF THE 17 CELL AREA. I want to write a macro that will THEN select a row of cells, 17 cells long, from the MANUALLY SELECTED position as at the moment of running the macro. Unfortunately the cells are not always on the same row in each sheet. On one sheet they may be on row 5, on another row 8 and on another, row 15 etc. I was wanting to be able to select a 17 cell range 'relative' to where the cursor is. How do I write the code to select the relative cell range? Is there an answer in an R[1]C[1]:R[1]C[17] sort of code?
View 7 Replies
View Related
Nov 21, 2007
I want my column to be populated by formula using VBA. Let's say on row1, the formula is = SUMIF(mysheet!$L:$L,$A1&C$1&"09",mysheet!$M:$M). And on row 2, the formula is
=SUMIF(mysheet!$L:$L,$A2&C$1&"09",mysheet!$M:$M). And on row 3, the formula is =SUMIF(mysheet!$L:$L,$A3&C$1&"09",mysheet!$M:$M). And this is done up to the last row. How do I do this?
View 9 Replies
View Related
Sep 19, 2006
Is there an easy to use macro or VBA function to delete the rows with "position" column value of a zero? I have both positive and negative values in the column. I tried to put on filter but am not sure how to make it a rule based function: i.e. show only < 0 <.
Date Type NamePosition
2006/09/20CRGJacob11167
2006/09/20CRGTom 0
2006/09/20CRGMark 58371
2006/09/20CRGSue0
2006/09/20CRGDawn0
View 6 Replies
View Related
Sep 9, 2008
I'm not a VB programmer and have tried to write this macro but I can't seem to understand why it's not working.
View 11 Replies
View Related
Jan 15, 2008
I've written a macro to unprotect a sheet, unhide columns and reprotect the sheet. It works fine with 2 out of 3 worksheets. I cant find any reason why it wont work in the one sheet....
View 9 Replies
View Related
Apr 25, 2014
Making a macro to work like this:
if each 4th row of each column (A to XFD) contain 1, hide every column that contain 1 at each 4th row..
So, when the result of my formula is 1 on D4, F4, and AB4, then D, F, and AB column would be hidden automatically when I ran the macro..
View 5 Replies
View Related
Nov 9, 2008
I am trying to hide/unhide several columns by hitting a button. It's a pretty simple macro to do it once, but how do I get a button to hide on the first click, then unhide on the second?
View 3 Replies
View Related
Feb 8, 2014
I have a report that has percentage of row totals that just displays as 100% for the grand total column. I want to hide that percentage of row column. I've attached the excel file below to see the pivot tables.
detail report.zip‎
View 3 Replies
View Related
Mar 16, 2009
I have a macro that looks at a list of students and the school they attend, and then creates an individual worksheet for each school containing only their students. I want to hide Column B on each of those worksheets. This seems like it should be easy, but it is not working.
When I leave it as is pasted below, Column B does not get hidden.
When I change it to Sheets(school.Value).Columns("B").Select I get an error message stating "Select method of Range class failed."
Sub ExtractSchools()
Dim wsTransfer As Worksheet 'worksheet with transferred data from registrations wrkbk
Dim wsList As Worksheet 'worksheet with list of students
Dim wsNew As Worksheet 'worksheet being added for a school
Dim wSheet As Worksheet 'name to loop through all worksheets
Dim rng As Range
Dim school As Range
Dim rowNum As Integer
Set wsTransfer = Sheets("Transfer")
Set wsList = Sheets("Student List")
wsTransfer.Select
Range("Database_Transfer").AdvancedFilter xlFilterCopy, Range("Criteria"), _
wsList.Range("Database_Unique").........................................
View 9 Replies
View Related
Aug 15, 2006
I have read several related threads and tried to adapt their answers to my application with no success. I am trying to write a macro that will hide rows based on that row's value in a certain column. Specifically, column AB contains sums and if a sum equals 0 I want to hide that row. The sums start at AB5 and go to AB118 but there are 4 gaps in the column at rows 25, 47, 70, and 94.
View 9 Replies
View Related
Jan 29, 2014
I would like to have a macro that will hide a column based on the value in the row. I have multiple sheets and if row 4 (or more specific, B4:AL4) contains a zero, then I'd like the whole column to be hidden on that sheet. I'd like to be able to run the macro and it evaluate every worksheet.
View 5 Replies
View Related
Jun 24, 2009
I have this code below that deletes any single occurrence of a customer number but the "Customer Numbers" must be in column A.
I would like to change the code below to instead look for the "Customer Number" column by name, rather than by column A. My "Customer Number" column will always be in row 1, but yet, it will be in a different column letter every time I run the report.
View 2 Replies
View Related
Jun 18, 2009
I want to create a macro that checks whether a specified range of columns is hidden, and
a) hide them if they are not hidden, or
b) unhide them if they are hidden,
i.e. toggle the Hide state.
What method can I use to query the hidden state of a selected range of columns and return a boolean value?
View 2 Replies
View Related
Feb 17, 2009
A simple question:
I have a column of numbers, for example:
2
5
5
8
8
8
20
50
I would like to know the value that corresponds to (for ex.) 5th position from, of course, the beginning of the column, ie 8.
View 2 Replies
View Related
May 26, 2009
How to find position of lust number in column (non macro preferably).
2
3
1
3
2
1
3
2
1
For number 1 match will return 3 but I need 9 (and I can't sort column opposite)
View 4 Replies
View Related
Feb 11, 2010
I'm just learning VBA and attempting to modify an existing piece of code. My only question is where it's possible to refer to a column in relative terms. In others words for the following:
If Target.Column = 33 Then
Is there a way to ensure that if users create or delete columns resulting in the current column 33 now changing to column 34 or 32, my code still applies to the correct column?
View 9 Replies
View Related
Jan 15, 2009
In the following code, you will find a sorting function with a range is hard coded. Instead of hard coded value which is marked with red colour, i need to find that range value dynamically. How to write a code to find that ?
View 2 Replies
View Related
Jan 9, 2014
I have 6 column charts that are supposed to be identical. There are 12 pair of columns per chart. Some chart's pair are centered over the tick and some pair are to the right of the tick and I can't figure out how to make them all the same.
View 1 Replies
View Related
Oct 16, 2013
I have e.g. 3 colums, A, B and C.
In column A there is A number on every row.
In column B there is a number on ever row.
In column C I want to compile a new list such that if a number in column B is X (eg 1) the number from column A at the corresponding cell should be copied to column C. I want there to be no empyt cells in column C. So for the list below, the number in column A should be copied to C if its corresponding B cell is 0.
64
0
64
64
0
64
57
0
57
[Code] .......
View 4 Replies
View Related
Dec 12, 2009
I am trying to create a schedule using colors. The colors will indicate the start time, break time, lunch time, break time (second break) and end time. see attached document.
Thank you for attempting to solve this puzzle using formulas and or VBA code. I am trying to automate the schedule so the numerical times automatically appear when I "paint" the schedule.
View 5 Replies
View Related
Nov 10, 2011
I will be working with an array of data approx 500 rows by 50 columns (eg Sheet1!$A$1:$CV$500) in which I will need to check if approx 1000 unique values exist and in which column they appear in. Each unique value should not appear in more than 1 column. Once identified, I need to return the header value at the top of the relevant column.
My thoughts on approach would be perform a lookup of some sort to identify the column number and then use that within an index formula to return the header value based on the column number.
However, I'm not sure how to perform a lookup to get the column number. A match formula can, as far as I am aware, only lookup against a single column or single row.
View 3 Replies
View Related
Mar 15, 2014
I have a below formula which extracts the v and number attached to it I would like to copy this across all columns and change row for each column. So for example 1st column reference will be B4, the second column would have a reference B5 and so on, it's probably worth to mention that cells I am referencing to are in other sheet hence why there's Ref! before B4 is this why absolute column and relative row not working?
View 5 Replies
View Related
Aug 23, 2009
I need to figure out how I can get excel to write me a list of permutations / combinations for the Group (column a) and Item (column b) columns in the example. The group designates the items that should be inlcuded in the combination / permutation in Related Items (column c). I have thousands of lines to do this with so I need to figure a way to automate it. I have started the Related Items column which is the results I need output. If it could format it like this adding in the space between the rows as it outputs the answer that would be perfect. Anyone know how to do this? I've found many answers, but none that have 2 columns with separate grouping within the column.
View 4 Replies
View Related
Jun 1, 2006
I can record a macro that will sum a column of data at the end of data in that column - simple; my problem is getting it to work on other workbooks that have a different amount of rows in it. I tried recording the macro using the relative button as well as without using it, but either way I do it, I can never get it to work on a different workbook. For example, I record the macro, then remove a couple rows after to simulate running on another workbook, and then when I run it, the sum gets put in the cell that used to be the end of the column instead of the real end of the column…Same is true if I add some rows. I don't know if I am using the right terminology below (OK, I know I'm not) but it gets the message across best when I say I think I need something that will do the following (substitute "code" for "make believe code"):
1. Go To cell F1
2. Go To last entry In this column
3. Move down one cell
4. Sum F2:Fx (where x = one cell above current selection - the last populated cell In the column With data In it before the sum)
Instead of this (what I have right now)................
View 6 Replies
View Related