i am pretty good with VBA after reading a lot of information on the internet but i have a problem i cannot solve:
I have two workbooks with the same sheet names and I am trying to transfer the interior colour of cells from one workbook to the other...
this is the code i came up so far but it doesn't work
With Application.Workbooks(WB1).Worksheets For Each ws In Application.Workbooks(WB2).Worksheets On Error Resume Next For Each cl In ws.UsedRange WB1.ws.cl.Interior.ColorIndex = WB2.ws.cl.Interior.ColorIndex Next cl
I am working with a workbook that has data automatically entered each time a new child is enrolled to the program. The child's data is automatically entered to the sheet named "Intake". What I need to do now is rename that sheet using the child's name as the sheet name, but also keep the sheet named "Intake" for the next entry. I would then like to sort the sheets alphabetically but leaving the "Intake" sheet either as the first sheet or the last sheet. I have attached an example of the workbook I am working with.
I use the command ActiveWindow.SelectedSheets.Copy to copy selected sheets into a new workbook. As a result of this line is a new workbook created and a the selected sheets are pasted into the new workbook. Is it possible to paste only values by using a single line like this?
I would like to be able to select several non-sequential rows in a worksheet called "Data" (using a check box or just entering a value in Column A) and then be able to press a Command button to copy the selected rows to another worksheet called "Estimate" at the bottom of a table, and delete the designators in Column A (i.e. deletes the value, or unchecks the boxes) so I can repeat the process again if needed.
Here's what I'm trying to do (improperly apparently!!):
Book1, ''Master'' is the sheet, I'm copying info into, and Company info are the sheets im getting info from each of my .xls files in a folder, ie cell C2. Just in case, to be clear, I have all my vba projects opened from each .xls book, and need to copy, from each .xls book, in Company info, cell C2 into Master column A:
Sub collate_cell_data() Dim dest As Range, wbNew As Workbook, wb
I have a workbook with about 25 sheets. All the sheets are named. I'd like either a Macro or some VBA code whcih, when the user clicks a button will Unhide selected sheets, say "Equip Labor", "Equipment", Proj. Summary" and "Implementation Guide" and then copy these sheets into a new workbook created on the fly (Book1.xls) and then in the original workbook re-hide all the selected sheets. This way the user can save the new workbook as whatever name they want. Is this possible? The closest post I could find was this: http://www.mrexcel.com/forum/showthr...opy+Worksheets I tried to modify this, but I'm not that good yet with VBA.
how you would write a macro to move a selection of sheets to a workbook called Digi's in the D drive. Also if there isn't a Workbook called Digi's already it needs to add one. I've found some code to loop through sheets but nothing to show what sheets the user has selected
As I am managing a few projects at once, I would like to create a To Dos List for each project (seperated by different worksheets). To make my life a bit easier, I hope to show all the To Dos which is due on a particular day on a separate worksheet. In other words, I am hoping to write a macro which allows me to copy all the relevant To Dos (of that day) from different worksheets and compiled it into a single list on a new worksheet.
1) Each row of To Do contains 3 columns, Date, Priority and Descriptions. 2) The To Dos for each project are NOT arrange in sequence by dates. 3) Number of project will increase over time, therefore the number of worksheets will also increase.
I have set up the attached workbook to try to show the results that I need using the matching shaded cells in the worksheets.
The first part of the problem is that all data in columns A, B, C & H (Input1) needs to be copied to columns A, B, C & F in Input2 with the addition of a Zero value in columns D & E (sample data lines 1 - 3).
The second part of the problem is that all data in columns A, B, & F (Input2) where the cell in column C is equal to ZERO needs to be copied to columns A, B & C in Input 3 (sample data Lines 4 - 11).
It would also be useful to be able to copy data in columns A, B, & F (Input2) where the cell in column C is NOT equal to ZERO to columns A, B & C in Input 3 (sample data Lines 12 - 25). However, there will be often be more than value in column C (Input2) dictated by the date in Column A and number in Column B. The value in Column F (Input2) will always be the same for each of those rows, so it does not need to be duplicated in Column C (Input3).
This would have to be manually triggered by linking it to a button or menu item, not sure what would be the best option. As data is entered at various times of the week, the routine would either have to overwrite existing matching data or carry on from where it last finished!
I am self-taught (arguably by a pretty shoddy teacher), and am determined to figure *some* of this stuff out. I need a code to look at the rows on one worksheet and based on the value of column A for each row, copy cells A through E in that row to cells A through E of a blank row on a corresponding worksheet. I found a code from another post that does just what I need it to with one small exception. The code was posted by DaveGuggs and is as follows:
I need, I do not know Visual Basic, so I need something in simple Excel format that I can use before I am able to take the training (upon reading more threads, looks like VBA is just the editor used to create a macro where I can copy and paste in code text from your suggestions? I think I can handle that).
I need to condense multiple tables into one master table, and then perform calculations on those entries. Each table contains three columns, but after being manually pasted -- as I am doing currently -- into the condensed worksheet, there'll be two or three additional columns based on calculations from the entries. The Workbook does currently contain 2 worksheets that do not contain data in this format, so please share code that could exclude those? I am fine with every so often manually applying a formula on the last worksheet that says something like,
look in SH1 A2:C300. If entire row is not blank copy over contents, if blank move on to SH2, etc etc. Since I'm a newbie I imagine there are much more efficient ways to do this. I may be a little shaky on the VBA but surely I can copy and paste.
I have found the following code on this forum that has really worked well. This code matches the first two columns of two worksheets and inputs them into a third worksheet. But I need to be able to copy up to five more columns, a total of seven columns and have it input into the third worksheet. I am not sure what it means "For Each c In Sht1Rng". look at the code and advise me of what I need to do.
Sub FindMatches() Dim Sht1Rng As Range Dim Sht2Rng As Range Set Sht1Rng = Worksheets("Data1").Range("A1", Worksheets("Data1").Range("A65536").End(xlUp)) Set Sht2Rng = Worksheets("Data2").Range("A1", Worksheets("Data2").Range("A65536").End(xlUp)) For Each c In Sht1Rng Set d = Sht2Rng. Find(c.Value, LookIn:=xlValues) If Not d Is Nothing Then Worksheets("Results").Range("A65536").End(xlUp).Offset(1, 0).Value = c.Value Worksheets("Results").Range("A65536").End(xlUp).Offset(0, 1).Value = c.Offset(0, 1).Value Set d = Nothing End If Next c
I have a workbook that updates from external source and creates sheets depending on a cell range.
I have put tab 1 and tab 0 on either end of where the new sheets will be inputted, will never know how many sheets
What i need to happen is if someone fills in "complete" in A7 in my "summary" sheet then the values in row 6 in all the other sheets get hardcoded. This needs to happen from A7 down to A26, so A8 = complete then copy row 7 etc This is what i have so far
I get compile error here ........Sheets(ArrSh(1)).Activate
Also need it to work for all the other rows.
Sub hardcode() ' 'Sheets("Summary"). Select If Range("a7") = "complete" Then ' Sheets(Array("1", "0")).Select Sheets(ArrSh(1)).Activate
I have this Excel File which has some sheets. All sheets are the same format like this: "I have read-circled the cells of interest"
I want to have a macro that can read the data from all the sheets (regardless of their name) and from the specific cells "red-circled" and copy and paste them into new sheet named "Report" in table format. Like this:
The data to be filtered is in several sheets, and once filtered is to be copied to a destination sheet (in this case "Temp"). The criteria for advanced filter is on an altogether different sheet (in this case "Reports"). The macro is actually simplified for the purpose of the question, and I want to re-use the code several times, hence the use of variable "filterRng". When I run it, I get the subject error at the bolded line in the code below. I'm thinking that the Advanced Filter doesn't like a variable as a range reference, as it runs perfectly well if the commented out line below the problem line is used instead.
Dim i As Integer Dim rngData As Range Dim filterRng As Range
Set filterRng = Sheets("Reports").Range("A121:K124")
In Sheet1 cells A1-BW46 (3450 cells), using 9 different colors to fill all the cells.
In Sheet3, starting in A2, I have a plain text list of 3450 cell ranges "A1", "A2", "A3" etc covering all 3450 cells in Sheet1.
I want to populate next to this list the interior color value of the corresponding cell. So in cell A2, I will have the text "A1", in cell B2 I would have either a numerical or text value giving me the color that A1 in sheet1 is filled with.
The script doesn't have to auto update, I will run manually when neededI don't need any manipulation, only the value of the color, and that can be hex, rgb.
I can't upload the actual sheet I'm working with, but if my description of the problem is lacking, I may be able to create a sample sheet to give the idea.
I'm trying to write a routine that will display the Red, Green and Blue RGB properties of a cell's interior colour.
I found the following function:
Function SingleColorFromRGB(colorWanted As String, RGBValue As Long) As Long Dim rColor As Long, gColor As Long, bColor As Long If RGBValue < 0 Then GoTo ReturnError rColor = RGBValue Mod 256 RGBValue = Int(RGBValue / 256) gColor = RGBValue Mod 256
How I should call this function in a worksheet, or failing that, come up with something better e.g. a message box that will display the numeric values of each RGB property for the selected cell, or a single cell worksheet name?
I occasionally give presentations with Excel and would like to make it easier for the audience to see a particular cell when I move to it. The cursor can be tiny, and some people have a hard time seeing the cursor, so I use the keyboard to navigate to the cells I talk about. Yet, the cell, which then has a border around it, still can be hard to see.
Is there a way in Excel to have a cell that is highlighted, that is I move to a cell with the keyboard, so that it pops out in a different font color or background or format, when I move to it, and it automatically reverts to its usual format and color when I move away from it?
I am using vlookup to get some data from one shhet in my workbook onto the front sheet so I have a search box and the vlookup duly does as it should and gets me the data into E28:E100 and fills the cells to the right with corresponding data for each item Now I select any cell from the first column of the search results I want and it gets pasted into the next empty cell range C4:C22 all this works a treat thanks to lots of help from mr excel. What I want to do (without any more vlookups) is pick up the corresponding cells to the right of the selected cell and paste them into the cells to the right of the pasted cell. I cant do it all at once because there is a different amount of columns between the select area and the paste area... hope this is clear here is a snippet of code that lets me choose the cell to paste
Dim UserResponse as range 'InputBox to Ask the user to select the cell they want copying 'First direct them to the start cell in the column they are picking from Range("E28").Select On Error Resume Next Set userResponse = Application.InputBox("Choose from List Below", Default:=Selection.Address, Type:=8) On Error GoTo 0 If userResponse Is Nothing Then End
Else userResponse.Copy (here I want to get the address of the cell into store so I can pick up the addresss of 2 cells to the right of it ie selected cell is E54 and I want to copy that and G54 and N24 and paste them into C8 D8 and F8 repectively) End If
I have 2 different worksheets...each of them containing item numbers. On Sheet1, Column A contains the item numbers. I have conditional formatting to change the interior color of column A based on several criteria.
On Sheet2, I also have item numbers, but they are located in Column B. If item 12345 in Column A on Sheet1 has an interior color of yellow, I would like that same item on Sheet2 to have an interior color of yellow.
I have a userform which stores the backcolour value of some labels in a spreadsheet so that it can be recalled dependent on what month a user selects. The trouble is that in a spreadsheet, I want to use these backcolor values to colour the interior of a cell. However, the values don't seem to be liked by VBA and I get a 'subscript out of range' when I try to match:
This error comes up against values 65535 and -2147483633
What am I doing wrong? what would be the best way to store a backcolor value in one cell so that it can be used for a cell interior colour?
i'd like to use a macro to loop through a range of cells and change the interior color index based on the cell values (ex. if cell value < 10, set interior to blue, if cell value > 400, set to green) i'm trying a for each loop with an if statement but i keep getting syntax errors, i know this is probably a simple problem but i'm not experienced in vb,