$$Excel-Macros$$ Writing a string to a particular cell

2013-10-08 Thread Jewel Sharma
Hi,
This should have a quick fix hopefully. Please tell me what's is wrong with 
the following lines in the code:
sStr1 = Personnel   iNumPer + 1
ThisWorkbook.Worksheets(Job Details).Range(Cells(4, iPasteCol)).Value = 
sStr1

When i run the code, I receive
*Run-time error '1004':*
*Application-defined or object-defined error*

sStr1 is declared as a string. iNumper is declared as an Integer. 
iPasteCol is declared as an Integer. I've used MsgBox to confirm the 
values stored in them are correct.
Currently, iNumper = 1, sSTR1 = Personnel 2, iPasteCol = 19.

All I want to do is to write [Personnel 2] in cell S4 of the worksheet Job 
Details; but I need to use the column index number instead of the letter. 
I've tried Range.Text, as well as Range.FormulaR1C1; but I receive the same 
error.

Thanks in advance.
Jewel

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups MS 
EXCEL AND VBA MACROS group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/groups/opt_out.


Re: $$Excel-Macros$$ Using Userform as Navigation Pane to move between worksheets

2013-10-02 Thread Jewel Sharma
Hi Ashish,
This is great, but doesn't meet my need. Allow me to explain:

The workbook will have certain hidden sheets that the user does not need 
to interact with. That is why I'm hiding the *Sheet tabs.* So, I need a 
Navigation Pane that would allow the user to move only to the 8 
worksheets where they have to make certain inputs. Also, having such a 
Navigation Pane always displayed would give a better look to the 
workbook. 

Is it possible to activate/select a particular cell on a particular 
worksheets; say cell C3 on Sheet1 when the user clicks a LABEL or 
COMMAND BUTTON on such a USERFORM,  

Thanks.
Jewel

On Wednesday, October 2, 2013 2:12:29 PM UTC+8, ashish wrote:

 try this
 Sub test()
 Application.CommandBars(Workbook tabs).ShowPopup
 End Sub




 On Wed, Oct 2, 2013 at 11:26 AM, Jewel Sharma jewel...@gmail.comjavascript:
  wrote:

 Hi,
 I have a workbook with 8 worksheets; wherein I anticipate the user would 
 move to and fro between them in the course of using the workbook. To 
 simplify navigation, I intend to do the following:

1. Create a Userform that has labels for all worksheets.
2. Such userform should be always visible in the right hand corner of 
the application window.
3. Use the Label_Click() event or CommandButton_Click() event to let 
the user select the worksheet they need to work on. 

 What code should go in the 
 Private Sub Label1_Click() 

 event to SELECT/ACTIVATE Sheet1. Please advise.



 I need such a Userform based worksheet navigation approach as I need to 
 hide sheet tabs, scroll bars, row/column headers.

 Jewel

 -- 
 Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
 =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
 https://www.facebook.com/discussexcel
  
 FORUM RULES
  
 1) Use concise, accurate thread titles. Poor thread titles, like Please 
 Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice 
 will not get quick attention or may not be answered.
 2) Don't post a question in the thread of another member.
 3) Don't post questions regarding breaking or bypassing any security 
 measure.
 4) Acknowledge the responses you receive, good or bad.
 5) Jobs posting is not allowed.
 6) Sharing copyrighted material and their links is not allowed.
  
 NOTE : Don't ever post confidential data in a workbook. Forum owners and 
 members are not responsible for any loss.
 --- 
 You received this message because you are subscribed to the Google Groups 
 MS EXCEL AND VBA MACROS group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to excel-macros...@googlegroups.com javascript:.
 To post to this group, send email to excel-...@googlegroups.comjavascript:
 .
 Visit this group at http://groups.google.com/group/excel-macros.
 For more options, visit https://groups.google.com/groups/opt_out.




 -- 
 *Regards*
 * *
 *Ashish Koul*


 *Visit*
 *My Excel Blog http://www.excelvbamacros.com/*
 Like Us on 
 Facebookhttp://www.facebook.com/pages/Excel-VBA-Codes-Macros/15180389897
 Join Us on Facebook http://www.facebook.com/groups/163491717053198/


 P Before printing, think about the environment.

  
  

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups MS 
EXCEL AND VBA MACROS group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/groups/opt_out.


Re: $$Excel-Macros$$ Using Userform as Navigation Pane to move between worksheets

2013-10-02 Thread Jewel Sharma
Brilliant mate. Works very well.

On Wednesday, October 2, 2013 3:11:27 PM UTC+8, ashish wrote:

 try attached file


 On Wed, Oct 2, 2013 at 12:01 PM, Jewel Sharma jewel...@gmail.comjavascript:
  wrote:

 Hi Ashish,
 This is great, but doesn't meet my need. Allow me to explain:

 The workbook will have certain hidden sheets that the user does not 
 need to interact with. That is why I'm hiding the *Sheet tabs.* So, I 
 need a Navigation Pane that would allow the user to move only to the 8 
 worksheets where they have to make certain inputs. Also, having such a 
 Navigation Pane always displayed would give a better look to the 
 workbook. 

 Is it possible to activate/select a particular cell on a particular 
 worksheets; say cell C3 on Sheet1 when the user clicks a LABEL or 
 COMMAND BUTTON on such a USERFORM,  

 Thanks.
 Jewel

 On Wednesday, October 2, 2013 2:12:29 PM UTC+8, ashish wrote:

 try this
 Sub test()
 Application.CommandBars(**Workbook tabs).ShowPopup
 End Sub




 On Wed, Oct 2, 2013 at 11:26 AM, Jewel Sharma jewel...@gmail.comwrote:

 Hi,
 I have a workbook with 8 worksheets; wherein I anticipate the user 
 would move to and fro between them in the course of using the workbook. To 
 simplify navigation, I intend to do the following:

1. Create a Userform that has labels for all worksheets.
2. Such userform should be always visible in the right hand corner 
of the application window.
3. Use the Label_Click() event or CommandButton_Click() event to 
let the user select the worksheet they need to work on. 

 What code should go in the 
 Private Sub Label1_Click() 

 event to SELECT/ACTIVATE Sheet1. Please advise.



 I need such a Userform based worksheet navigation approach as I need to 
 hide sheet tabs, scroll bars, row/column headers.

 Jewel

 -- 
 Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? 
 It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
 https://www.facebook.com/**discussexcelhttps://www.facebook.com/discussexcel
  
 FORUM RULES
  
 1) Use concise, accurate thread titles. Poor thread titles, like Please 
 Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice 
 will not get quick attention or may not be answered.
 2) Don't post a question in the thread of another member.
 3) Don't post questions regarding breaking or bypassing any security 
 measure.
 4) Acknowledge the responses you receive, good or bad.
 5) Jobs posting is not allowed.
 6) Sharing copyrighted material and their links is not allowed.
  
 NOTE : Don't ever post confidential data in a workbook. Forum owners 
 and members are not responsible for any loss.
 --- 
 You received this message because you are subscribed to the Google 
 Groups MS EXCEL AND VBA MACROS group.
 To unsubscribe from this group and stop receiving emails from it, send 
 an email to excel-macros...@**googlegroups.com.
 To post to this group, send email to excel-...@googlegroups.com.
 Visit this group at 
 http://groups.google.com/**group/excel-macroshttp://groups.google.com/group/excel-macros
 .
 For more options, visit 
 https://groups.google.com/**groups/opt_outhttps://groups.google.com/groups/opt_out
 .




 -- 
 *Regards*
 * *
 *Ashish Koul*


 *Visit*
 *My Excel Blog http://www.excelvbamacros.com/*
 Like Us on 
 Facebookhttp://www.facebook.com/pages/Excel-VBA-Codes-Macros/15180389897
 Join Us on Facebook http://www.facebook.com/groups/163491717053198/


 P Before printing, think about the environment.

  
  
  -- 
 Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
 =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
 https://www.facebook.com/discussexcel
  
 FORUM RULES
  
 1) Use concise, accurate thread titles. Poor thread titles, like Please 
 Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice 
 will not get quick attention or may not be answered.
 2) Don't post a question in the thread of another member.
 3) Don't post questions regarding breaking or bypassing any security 
 measure.
 4) Acknowledge the responses you receive, good or bad.
 5) Jobs posting is not allowed.
 6) Sharing copyrighted material and their links is not allowed.
  
 NOTE : Don't ever post confidential data in a workbook. Forum owners and 
 members are not responsible for any loss.
 --- 
 You received this message because you are subscribed to the Google Groups 
 MS EXCEL AND VBA MACROS group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to excel-macros...@googlegroups.com javascript:.
 To post to this group, send email to excel-...@googlegroups.comjavascript:
 .
 Visit this group at http://groups.google.com/group/excel-macros.
 For more options, visit https://groups.google.com/groups/opt_out.




 -- 
 *Regards*
 * *
 *Ashish Koul*


 *Visit*
 *My Excel Blog http://www.excelvbamacros.com/*
 Like Us on 
 Facebookhttp://www.facebook.com/pages/Excel-VBA-Codes-Macros/15180389897

$$Excel-Macros$$ Using Userform as Navigation Pane to move between worksheets

2013-10-01 Thread Jewel Sharma
Hi,
I have a workbook with 8 worksheets; wherein I anticipate the user would 
move to and fro between them in the course of using the workbook. To 
simplify navigation, I intend to do the following:

   1. Create a Userform that has labels for all worksheets.
   2. Such userform should be always visible in the right hand corner of 
   the application window.
   3. Use the Label_Click() event or CommandButton_Click() event to let the 
   user select the worksheet they need to work on.

What code should go in the 
Private Sub Label1_Click() 

event to SELECT/ACTIVATE Sheet1. Please advise.



I need such a Userform based worksheet navigation approach as I need to 
hide sheet tabs, scroll bars, row/column headers.

Jewel

-- 
Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s 
=TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups MS 
EXCEL AND VBA MACROS group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to excel-macros+unsubscr...@googlegroups.com.
To post to this group, send email to excel-macros@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros.
For more options, visit https://groups.google.com/groups/opt_out.


$$Excel-Macros$$ Convert a CSV data string into Rows Columns

2012-12-05 Thread Jewel Sharma
Hi All,

I have a string with comma separated values (say N values)
(E.g. 233, 127, 139, 38, 560, 72, 56, 67, 45, 232, 28, 242, 344, 234, 034, 
072, 342, 34, 5, 34, 34, 6, 782, 342, 34, 234, 2, 423, 45, 23, 21, 56, 03, 
08, 56, 22, 94, 22.4, 23.1, 40, 45, 242, 475, 21, 24, 23, 423, 444, 24, 75, 
67)

I would like to build a macro that does the following:

   1. Breaks this string values into individual cells (say 1 row X N 
   columns, or 1 column X N rows).
   2. It ask the user to enter the no. of rows (say P) and no. of columns 
   (say Q); and then moves the data into P Rows X Q Columns.
   3. it should check that N = P X Q (just to confirm that the data will 
   fit into P X Q table).

For E.g. the above e.g. data string has 36 values, the macro should be able 
to covert these into a 1 X 36, 2 X 18, 3 X 12, 4 X 9, 6 X 6, 9 X 4, 12 X 3, 
18 X 2 and 36 X 1 rows and columns, as per the rows  columns desired by 
the user.

I believe this should be doable using a combination of UBound and 
Offset, but I'm just not able to piece together the logic.

Cheers !
Jewel

-- 
Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups MS 
EXCEL AND VBA MACROS group.
To post to this group, send email to excel-macros@googlegroups.com.
To unsubscribe from this group, send email to 
excel-macros+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros?hl=en.




Re: $$Excel-Macros$$ Pasting from Excel to Word - Issue with Column Width(s)

2012-11-28 Thread Jewel Sharma
Dear Ashish,
The columns are fixed. The number of rows is not. The rows are deleted, 
depending upon whether or not data is entered in them. E.g. sometimes a 
table may have 20 rows, sometimes 30 and sometimes only 3.

To give an idea behind the whole thing:

   1. I have a comprehensive word template ~ 100 pages. Where-in lots of 
   tables are completely deleted, and in certain tables - specific rows are 
   deleted depending upon whether or not any data is entered in those 
   rows. All in all, the final report comes out to only 40-50 pages.
   2. Though the word template works fine, almost half of the time is spent 
   in deleting rows, deleting tables and providing suitable page-breaks 
   etc... to make the whole thing presentable.
   3. Also, a lot of erroneous entries are made by the user when entering 
   the data - such as wrong values (31 instead of 13), misplaced decimal 
   points (13.1 instead of 1,31) etc...
   4. The idea of using Excel is to firstly control the data entry (using 
   conditional formatting, or data validation rules) so that incorrect values 
   are flagged and secondly  to automate the deletion of undesired tables or 
   specific rows, as the case may be - this using VBA. This part is all 
   working fine in my Excel template. 
   5. However, as I said earlier, the final submission has to be in Word, 
   and so I need to transfer all these 30-40 Excel Worksheets on a Word 
   document, one behind the other, which is also working fine. I get the whole 
   data copy-pasted in exactly the same order as desired.
   6. The only issue where I struggle is with Column Width. When I 
   copy-paste from Excel to Word using VBA, the Column-Widths change for 
   certain cells and I'm unable to figure out why it is so; and also unable to 
   figure out any alternate methods to do so. 

Any guidance with this Column Width issue?

Regards,
Jewel

On Tuesday, 27 November 2012 22:37:18 UTC+8, ashish wrote:

 if you rows and columns are fixed why do u create a blank template in word 
 document , merge cells , row ,etc as per your need 

 Then run a  loop through all the cells in table to add data in word 
 document


 Regards
 Ashish

 On Tue, Nov 27, 2012 at 6:15 PM, Jewel Sharma jewel...@gmail.comjavascript:
  wrote:

 Guys - I'm facing issues with column width when pasting from Excel to 
 Word.
 Briefly,

- I have an Excel file comprising of several worksheets. Each 
worksheet comprises of several tables (with specific column width and row 
heights). 
- Certain cells within these tables are merged while others are 
single cells (not sure if this is relevant, just preempting a query).
- This sheet helps to collect the data in an orderly manner at the 
specified location (data is entered manually at the specified cells). 
- After all the data is gathered, I need to transfer (read 
copy-paste) it to a word document as the submission needs to be in MS 
 Word.
- When I do that, I find that column widths for certain cells are not 
maintained as they are in Excel - I observe both increase and decrease in 
Column Width sizes. 
- However, the results are consistent. By that I mean, everytime I 
run the macro, the same cells/or group of cells are affected.
- I have tried using Word Selection.PasteSpecial from within Excel 
with Link:= true and false both, Placement:=wdInLine 
 DisplayAsIcon:=False, 
Data:=wdPasteHTML 
- I have also tried using calling a function in the word document 
(Word Selection.PasteExcelTable False False False) from within excel, 
 but 
still having the same issue with the same cells. 

 Is there a solution to ensure that the column widths remain exactly the 
 same when pasting from Excel to Word?
 Has cell padding got anything to do with it? I noticed that the Excel 
 cells have zero padding, whereas the default indent in MS Word Tables is 
 0.19cm.

 Any help or guidance would be appreciated.
 Regards,

 Jewel

 PS: If a similar query has been posted before - kindly direct me to that 
 post.

 -- 
 Join official Facebook page of this forum @ 
 https://www.facebook.com/discussexcel
  
 FORUM RULES
  
 1) Use concise, accurate thread titles. Poor thread titles, like Please 
 Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice 
 will not get quick attention or may not be answered.
 2) Don't post a question in the thread of another member.
 3) Don't post questions regarding breaking or bypassing any security 
 measure.
 4) Acknowledge the responses you receive, good or bad.
 5) Jobs posting is not allowed.
 6) Sharing copyrighted material and their links is not allowed.
  
 NOTE : Don't ever post confidential data in a workbook. Forum owners and 
 members are not responsible for any loss.
 --- 
 You received this message because you are subscribed to the Google Groups 
 MS EXCEL AND VBA MACROS group.
 To post to this group, send email to excel-...@googlegroups.comjavascript

$$Excel-Macros$$ Pasting from Excel to Word - Issue with Column Width(s)

2012-11-27 Thread Jewel Sharma
Guys - I'm facing issues with column width when pasting from Excel to 
Word.
Briefly,

   - I have an Excel file comprising of several worksheets. Each worksheet 
   comprises of several tables (with specific column width and row heights).
   - Certain cells within these tables are merged while others are single 
   cells (not sure if this is relevant, just preempting a query).
   - This sheet helps to collect the data in an orderly manner at the 
   specified location (data is entered manually at the specified cells).
   - After all the data is gathered, I need to transfer (read copy-paste) 
   it to a word document as the submission needs to be in MS Word.
   - When I do that, I find that column widths for certain cells are not 
   maintained as they are in Excel - I observe both increase and decrease in 
   Column Width sizes.
   - However, the results are consistent. By that I mean, everytime I run 
   the macro, the same cells/or group of cells are affected.
   - I have tried using Word Selection.PasteSpecial from within Excel 
   with Link:= true and false both, Placement:=wdInLine DisplayAsIcon:=False, 
   Data:=wdPasteHTML
   - I have also tried using calling a function in the word document (Word 
   Selection.PasteExcelTable False False False) from within excel, but still 
   having the same issue with the same cells.

Is there a solution to ensure that the column widths remain exactly the 
same when pasting from Excel to Word?
Has cell padding got anything to do with it? I noticed that the Excel cells 
have zero padding, whereas the default indent in MS Word Tables is 
0.19cm.

Any help or guidance would be appreciated.
Regards,

Jewel

PS: If a similar query has been posted before - kindly direct me to that 
post.

-- 
Join official Facebook page of this forum @ 
https://www.facebook.com/discussexcel

FORUM RULES

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Jobs posting is not allowed.
6) Sharing copyrighted material and their links is not allowed.

NOTE  : Don't ever post confidential data in a workbook. Forum owners and 
members are not responsible for any loss.
--- 
You received this message because you are subscribed to the Google Groups MS 
EXCEL AND VBA MACROS group.
To post to this group, send email to excel-macros@googlegroups.com.
To unsubscribe from this group, send email to 
excel-macros+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/excel-macros?hl=en.